pub enum BezierSegment<T = f64>where
T: CoordFloat,{
Bezier(BezierCurve<T>),
Line(Line<T>),
}Expand description
A BezierSegment is either a straight Line or a BezierCurve
Variants§
Implementations§
Source§impl<T> BezierSegment<T>where
T: CoordFloat,
impl<T> BezierSegment<T>where
T: CoordFloat,
Sourcepub fn is_bezier_curve(&self) -> bool
pub fn is_bezier_curve(&self) -> bool
Is this segment a cubic bezier?
Sourcepub fn handles(&self) -> Option<(Coord<T>, Coord<T>)>
pub fn handles(&self) -> Option<(Coord<T>, Coord<T>)>
Return the handles of this segment, or None if this segment is a line
Sourcepub fn new(
start: Coord<T>,
handles: Option<(Coord<T>, Coord<T>)>,
end: Coord<T>,
) -> BezierSegment<T>
pub fn new( start: Coord<T>, handles: Option<(Coord<T>, Coord<T>)>, end: Coord<T>, ) -> BezierSegment<T>
Construct a Bezier segment given the start, end and optionally two handles
Sourcepub fn length_approximation(&self) -> T
pub fn length_approximation(&self) -> T
Get an approximation of the euclidean length of the bezier segment For the cubic bezier this is taken as the mean of the distance between the end points and the distance from start to end through the handles For the line it is simple the euclidean line length
Sourcepub fn to_line_string(&self, error: T) -> Result<LineString<T>, Error>
pub fn to_line_string(&self, error: T) -> Result<LineString<T>, Error>
Get a LineString with at most error deviation from the Bezier segment
Trait Implementations§
Source§impl<T> Clone for BezierSegment<T>where
T: Clone + CoordFloat,
impl<T> Clone for BezierSegment<T>where
T: Clone + CoordFloat,
Source§fn clone(&self) -> BezierSegment<T>
fn clone(&self) -> BezierSegment<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for BezierSegment<T>where
T: Debug + CoordFloat,
impl<T> Debug for BezierSegment<T>where
T: Debug + CoordFloat,
Source§impl<T> From<[Coord<T>; 2]> for BezierSegment<T>where
T: CoordFloat,
impl<T> From<[Coord<T>; 2]> for BezierSegment<T>where
T: CoordFloat,
Source§impl<T> From<[Coord<T>; 4]> for BezierSegment<T>where
T: CoordFloat,
impl<T> From<[Coord<T>; 4]> for BezierSegment<T>where
T: CoordFloat,
Auto Trait Implementations§
impl<T> Freeze for BezierSegment<T>where
T: Freeze,
impl<T> RefUnwindSafe for BezierSegment<T>where
T: RefUnwindSafe,
impl<T> Send for BezierSegment<T>where
T: Send,
impl<T> Sync for BezierSegment<T>where
T: Sync,
impl<T> Unpin for BezierSegment<T>where
T: Unpin,
impl<T> UnsafeUnpin for BezierSegment<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for BezierSegment<T>where
T: UnwindSafe,
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§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