pub struct QLineF { /* private fields */ }
Expand description
The QLineF class provides a two-dimensional vector using floating point precision.
Implementations§
Source§impl QLineF
impl QLineF
Sourcepub fn angle_to(&self, line: &QLineF) -> f64
pub fn angle_to(&self, line: &QLineF) -> f64
Returns the angle (in degrees) from this line to the given line, taking the direction of the lines into account. If the lines do not intersect within their range, it is the intersection point of the extended lines that serves as origin (see QLineF::UnboundedIntersection).
Sourcepub fn center(&self) -> QPointF
pub fn center(&self) -> QPointF
Returns the center point of this line. This is equivalent to (p1() + p2()) / 2, except it will never overflow.
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true if the line does not have distinct start and end points; otherwise returns false.
Sourcepub fn normal_vector(&self) -> QLineF
pub fn normal_vector(&self) -> QLineF
Returns a line that is perpendicular to this line with the same starting point and length.
Sourcepub fn point_at(&self, t: f64) -> QPointF
pub fn point_at(&self, t: f64) -> QPointF
Returns the point at the parameterized position specified by t. The function returns the line’s start point if t = 0, and its end point if t = 1.
Sourcepub fn set_angle(&mut self, angle: f64)
pub fn set_angle(&mut self, angle: f64)
Sets the angle of the line to the given angle (in degrees). This will change the position of the second point of the line such that the line has the given angle.
Sourcepub fn set_length(&mut self, length: f64)
pub fn set_length(&mut self, length: f64)
Sets the length of the line to the given length. QLineF will move the end point - p2() - of the line to give the line its new length, unless length() was previously zero, i in which case no scaling is attempted. For lines with very short lengths (represented by denormal floating-point values), results may be imprecise.
Sourcepub fn set_line(&mut self, x1: f64, y1: f64, x2: f64, y2: f64)
pub fn set_line(&mut self, x1: f64, y1: f64, x2: f64, y2: f64)
Sets this line to the start in x1, y1 and end in x2, y2.
Sourcepub fn set_points(&mut self, p1: &QPointF, p2: &QPointF)
pub fn set_points(&mut self, p1: &QPointF, p2: &QPointF)
Sets the start point of this line to p1 and the end point of this line to p2.
Sourcepub fn translated(&self, offset: &QPointF) -> QLineF
pub fn translated(&self, offset: &QPointF) -> QLineF
Returns this line translated by the given offset.
Sourcepub fn unit_vector(&self) -> QLineF
pub fn unit_vector(&self) -> QLineF
Returns the unit vector for this line, i.e a line starting at the same point as this line with a length of 1.0, provided the line is non-null.