pub struct PointF<'a> { /* private fields */ }
Expand description
Notice these docs are heavy WIP and not very relevent yet
A point is specified by a x coordinate and an y coordinate which
can be accessed using the x() and y() functions. The coordinates
of the point are specified using floating point numbers for
accuracy. The isNull() function returns true
if both x and y are
set to 0.0. The coordinates can be set (or altered) using the setX()
and setY() functions, or alternatively the rx() and ry() functions which
return references to the coordinates (allowing direct
manipulation).
Given a point p, the following statements are all equivalent:
A QPointF object can also be used as a vector: Addition and
subtraction are defined as for vectors (each component is added
separately). A QPointF object can also be divided or multiplied by
an int
or a qreal.
In addition, the QPointF class provides a constructor converting a QPoint object into a QPointF object, and a corresponding toPoint() function which returns a QPoint copy of this point. Finally, QPointF objects can be streamed as well as compared.
See also: QPoint QPolygonF
Licence
The documentation is an adoption of the original Qt Documentation and provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Implementations
sourceimpl<'a> PointF<'a>
impl<'a> PointF<'a>
pub fn new() -> PointF<'a>
sourcepub fn manhattan_length(&self) -> f32
pub fn manhattan_length(&self) -> f32
Returns the sum of the absolute values of x() and y(), traditionally known as the of the vector from the origin to the point.
See also: QPoint::manhattanLength()
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true
if both the x and y coordinates are set to 0.0 (ignoring
the sign); otherwise returns false.
sourcepub fn set_x(&self, x: f32) -> &Self
pub fn set_x(&self, x: f32) -> &Self
Sets the x coordinate of this point to the given x coordinate.
See also: x() setY()
sourcepub fn set_y(&self, y: f32) -> &Self
pub fn set_y(&self, y: f32) -> &Self
Sets the y coordinate of this point to the given y coordinate.
See also: y() setX()
sourcepub fn rx(&self) -> f32
pub fn rx(&self) -> f32
Returns a reference to the x coordinate of this point.
Using a reference makes it possible to directly manipulate x. For example:
See also: x() setX()
sourcepub fn ry(&self) -> f32
pub fn ry(&self) -> f32
Returns a reference to the y coordinate of this point.
Using a reference makes it possible to directly manipulate y. For example:
See also: y() setY()
sourcepub fn dot_product<P: PointFTrait<'a>>(p1: &P, p2: &P) -> f32
pub fn dot_product<P: PointFTrait<'a>>(p1: &P, p2: &P) -> f32
Returns the dot product of p1 and p2.
sourcepub fn to_point(&self) -> Point<'_>
pub fn to_point(&self) -> Point<'_>
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rounded coordinates.
See also: QPointF()