Struct piet_common::kurbo::Line
Expand description
A single line.
Fields
p0: PointThe line’s start point.
p1: PointThe line’s end point.
Implementations
impl Line
impl 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.
fn subdivide(&self) -> (Self, Self)
fn subdivide(&self) -> (Self, Self)
Subdivide into (roughly) halves.
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
fn gauss_arclen(&self, coeffs: &[(f64, f64)]) -> f64
fn gauss_arclen(&self, coeffs: &[(f64, f64)]) -> f64
Estimate arclength using Gaussian quadrature. Read more
impl ParamCurveExtrema for Line
impl ParamCurveExtrema for Line
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.
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 = LinePathIter
type PathElementsIter = LinePathIter
The iterator returned by the
path_elements method. Read morefn 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 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 RefUnwindSafe for Line
impl Send for Line
impl Sync for Line
impl Unpin for Line
impl UnwindSafe for Line
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
sourcefn round_from(x: T) -> T
fn round_from(x: T) -> T
Performs the conversion.
sourceimpl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
sourcefn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.