pub struct Line {
pub p0: Point,
pub p1: Point,
}
Expand description
A single line.
Fields§
§p0: Point
The line’s start point.
p1: Point
The 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 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)