Struct Line
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§
§impl Line
impl Line
pub const fn reversed(&self) -> Line
pub const fn reversed(&self) -> Line
Returns a copy of this Line with the end points swapped so that it
points in the opposite direction.
pub 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.
pub 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§
§impl Mul<Line> for TranslateScale
impl Mul<Line> for TranslateScale
§impl ParamCurve for Line
impl ParamCurve for Line
§fn subsegment(&self, range: Range<f64>) -> Line
fn subsegment(&self, range: Range<f64>) -> Line
Get a subsegment of the curve for the given parameter range.
§impl ParamCurveArclen for Line
impl ParamCurveArclen for Line
§impl ParamCurveArea for Line
impl ParamCurveArea for Line
§fn signed_area(&self) -> f64
fn signed_area(&self) -> f64
Compute the signed area under the curve. Read more
§impl ParamCurveCurvature for Line
impl ParamCurveCurvature for Line
§impl ParamCurveDeriv for Line
impl ParamCurveDeriv for Line
§type DerivResult = ConstPoint
type DerivResult = ConstPoint
The parametric curve obtained by taking the derivative of this one.
§fn deriv(&self) -> ConstPoint
fn deriv(&self) -> ConstPoint
The derivative of the curve. Read more
§impl ParamCurveExtrema for Line
impl ParamCurveExtrema for Line
§fn extrema(
&self,
) -> ArrayVec<f64, kurbo::::line::{impl#9}::extrema::{constant#0}>
fn extrema( &self, ) -> ArrayVec<f64, kurbo::::line::{impl#9}::extrema::{constant#0}>
Compute the extrema of the curve. Read more
§fn extrema_ranges(
&self,
) -> ArrayVec<Range<f64>, kurbo::::param_curve::ParamCurveExtrema::extrema_ranges::{constant#0}>
fn extrema_ranges( &self, ) -> ArrayVec<Range<f64>, kurbo::::param_curve::ParamCurveExtrema::extrema_ranges::{constant#0}>
Return parameter ranges, each of which is monotonic within the range.
§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
The smallest rectangle that encloses the curve in the range (0..1).
§impl ParamCurveNearest for Line
impl ParamCurveNearest for Line
§impl Shape for Line
impl Shape for Line
§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.
§type PathElementsIter<'iter> = LinePathIter
type PathElementsIter<'iter> = LinePathIter
The iterator returned by the
path_elements method.§fn path_elements(&self, _tolerance: f64) -> LinePathIter
fn path_elements(&self, _tolerance: f64) -> LinePathIter
§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
The smallest rectangle that encloses the shape.
§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
§fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
§fn as_rounded_rect(&self) -> Option<RoundedRect>
fn as_rounded_rect(&self) -> Option<RoundedRect>
If the shape is a rounded rectangle, make it available.
§fn as_path_slice(&self) -> Option<&[PathEl]>
fn as_path_slice(&self) -> Option<&[PathEl]>
If the shape is stored as a slice of path elements, make
that available. Read more
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 UnsafeUnpin for Line
impl UnwindSafe for Line
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more