pub enum BezierSegment<P: Point> {
Linear(LineSegment<P>),
Quadratic(QuadraticBezier<P>),
Cubic(CubicBezier<P>),
}Expand description
Sum type for line/quadratic/cubic Bezier segments.
Methods that need component access or norms add PointIndex/PointNorm
bounds as required.
Variants§
Implementations§
Source§impl<P> BezierSegment<P>where
P: Point,
impl<P> BezierSegment<P>where
P: Point,
Sourcepub fn is_linear<F>(&self, tolerance: F) -> bool
pub fn is_linear<F>(&self, tolerance: F) -> bool
Return true if the segment is linear within tolerance.
Sourcepub fn baseline(&self) -> LineSegment<P>
pub fn baseline(&self) -> LineSegment<P>
Return the baseline line segment between start and end.
Sourcepub fn bounding_box(&self) -> [(P::Scalar, P::Scalar); P::DIM]
pub fn bounding_box(&self) -> [(P::Scalar, P::Scalar); P::DIM]
Return the bounding box across all axes.
Sourcepub fn split<F>(&self, t: F) -> (BezierSegment<P>, BezierSegment<P>)
pub fn split<F>(&self, t: F) -> (BezierSegment<P>, BezierSegment<P>)
Split this segment into two sub-segments at t.
Sourcepub fn tangent(&self, t: P::Scalar) -> Pwhere
P: PointNorm,
pub fn tangent(&self, t: P::Scalar) -> Pwhere
P: PointNorm,
Return the unit tangent direction at t.
Sourcepub fn normal(&self, t: P::Scalar) -> Option<P>
pub fn normal(&self, t: P::Scalar) -> Option<P>
Return the principal normal direction at t.
Returns None if the velocity is zero or curvature is undefined.
Sourcepub fn t_at_length_approx(&self, s: P::Scalar, nsteps: usize) -> P::Scalarwhere
P: PointNorm,
pub fn t_at_length_approx(&self, s: P::Scalar, nsteps: usize) -> P::Scalarwhere
P: PointNorm,
Approximate parameter t at arc length s.
Sourcepub fn t_at_length(&self, s: P::Scalar) -> P::Scalarwhere
P: PointNorm,
pub fn t_at_length(&self, s: P::Scalar) -> P::Scalarwhere
P: PointNorm,
Approximate parameter t at arc length s using a default resolution.
Sourcepub fn point_at_length_approx(&self, s: P::Scalar, nsteps: usize) -> Pwhere
P: PointNorm,
pub fn point_at_length_approx(&self, s: P::Scalar, nsteps: usize) -> Pwhere
P: PointNorm,
Evaluate the point at arc length s.
Sourcepub fn point_at_length(&self, s: P::Scalar) -> Pwhere
P: PointNorm,
pub fn point_at_length(&self, s: P::Scalar) -> Pwhere
P: PointNorm,
Evaluate the point at arc length s using a default resolution.
Trait Implementations§
Source§impl<P: Clone + Point> Clone for BezierSegment<P>
impl<P: Clone + Point> Clone for BezierSegment<P>
Source§fn clone(&self) -> BezierSegment<P>
fn clone(&self) -> BezierSegment<P>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<P> Default for BezierSegment<P>
impl<P> Default for BezierSegment<P>
Source§impl<P> From<CubicBezier<P>> for BezierSegment<P>where
P: Point,
impl<P> From<CubicBezier<P>> for BezierSegment<P>where
P: Point,
Source§fn from(s: CubicBezier<P>) -> Self
fn from(s: CubicBezier<P>) -> Self
Converts to this type from the input type.
Source§impl<P> From<LineSegment<P>> for BezierSegment<P>where
P: Point,
impl<P> From<LineSegment<P>> for BezierSegment<P>where
P: Point,
Source§fn from(s: LineSegment<P>) -> Self
fn from(s: LineSegment<P>) -> Self
Converts to this type from the input type.
Source§impl<P> From<QuadraticBezier<P>> for BezierSegment<P>where
P: Point,
impl<P> From<QuadraticBezier<P>> for BezierSegment<P>where
P: Point,
Source§fn from(s: QuadraticBezier<P>) -> Self
fn from(s: QuadraticBezier<P>) -> Self
Converts to this type from the input type.
impl<P: Copy + Point> Copy for BezierSegment<P>
impl<P: Point> StructuralPartialEq for BezierSegment<P>
Auto Trait Implementations§
impl<P> Freeze for BezierSegment<P>where
P: Freeze,
impl<P> RefUnwindSafe for BezierSegment<P>where
P: RefUnwindSafe,
impl<P> Send for BezierSegment<P>where
P: Send,
impl<P> Sync for BezierSegment<P>where
P: Sync,
impl<P> Unpin for BezierSegment<P>where
P: Unpin,
impl<P> UnwindSafe for BezierSegment<P>where
P: 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