pub struct Line {
    pub p0: Point,
    pub p1: Point,
}Expand description
A single line.
Fields§
§p0: PointThe line’s start point.
p1: PointThe line’s end point.
Implementations§
Source§impl Line
 
impl Line
Sourcepub fn reversed(&self) -> Line
 
pub fn reversed(&self) -> Line
Returns a copy of this Line with the end points swapped so that it
points in the opposite direction.
Sourcepub fn midpoint(&self) -> Point
 
pub fn midpoint(&self) -> Point
The midpoint of the line.
This is the same as calling Point::midpoint with
the endpoints of this line.
Sourcepub fn crossing_point(self, other: Line) -> Option<Point>
 
pub fn crossing_point(self, other: Line) -> Option<Point>
Computes the point where two lines, if extended to infinity, would cross.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Line
 
impl<'de> Deserialize<'de> for Line
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Mul<Line> for TranslateScale
 
impl Mul<Line> for TranslateScale
Source§impl ParamCurve for Line
 
impl ParamCurve for Line
Source§impl ParamCurveArclen for Line
 
impl ParamCurveArclen for Line
Source§impl ParamCurveArea for Line
 
impl ParamCurveArea for Line
Source§fn signed_area(&self) -> f64
 
fn signed_area(&self) -> f64
Compute the signed area under the curve. Read more
Source§impl ParamCurveCurvature for Line
 
impl ParamCurveCurvature for Line
Source§impl ParamCurveDeriv for Line
 
impl ParamCurveDeriv for Line
Source§type DerivResult = ConstPoint
 
type DerivResult = ConstPoint
The parametric curve obtained by taking the derivative of this one.
Source§fn deriv(&self) -> ConstPoint
 
fn deriv(&self) -> ConstPoint
The derivative of the curve. Read more
Source§impl ParamCurveExtrema for Line
 
impl ParamCurveExtrema for Line
Source§fn extrema_ranges(&self) -> ArrayVec<Range<f64>, { _ }>
 
fn extrema_ranges(&self) -> ArrayVec<Range<f64>, { _ }>
Return parameter ranges, each of which is monotonic within the range.
Source§fn bounding_box(&self) -> Rect
 
fn bounding_box(&self) -> Rect
The smallest rectangle that encloses the curve in the range (0..1).
Source§impl ParamCurveNearest for Line
 
impl ParamCurveNearest for Line
Source§impl Shape for Line
 
impl Shape for Line
Source§fn area(&self) -> f64
 
fn area(&self) -> f64
Returning zero here is consistent with the contract (area is only meaningful for closed shapes), but an argument can be made that the contract should be tightened to include the Green’s theorem contribution.
Source§type PathElementsIter<'iter> = LinePathIter
 
type PathElementsIter<'iter> = LinePathIter
The iterator returned by the 
path_elements method.Source§fn path_elements(&self, _tolerance: f64) -> LinePathIter
 
fn path_elements(&self, _tolerance: f64) -> LinePathIter
Source§fn bounding_box(&self) -> Rect
 
fn bounding_box(&self) -> Rect
The smallest rectangle that encloses the shape.
Source§fn into_path(self, tolerance: f64) -> BezPathwhere
    Self: Sized,
 
fn into_path(self, tolerance: f64) -> BezPathwhere
    Self: Sized,
Convert into a Bézier path. Read more
Source§fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
 
fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
Source§fn as_rounded_rect(&self) -> Option<RoundedRect>
 
fn as_rounded_rect(&self) -> Option<RoundedRect>
If the shape is a rounded rectangle, make it available.
impl Copy for Line
impl StructuralPartialEq for Line
Auto Trait Implementations§
impl Freeze for Line
impl RefUnwindSafe for Line
impl Send for Line
impl Sync for Line
impl Unpin for Line
impl UnwindSafe for Line
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more