logo
pub trait Segment: Copy + Sized {
    type Scalar: Scalar;

Show 14 methods fn from(&self) -> Point<Self::Scalar>; fn to(&self) -> Point<Self::Scalar>; fn sample(&self, t: Self::Scalar) -> Point<Self::Scalar>; fn derivative(&self, t: Self::Scalar) -> Vector<Self::Scalar>; fn split(&self, t: Self::Scalar) -> (Self, Self); fn before_split(&self, t: Self::Scalar) -> Self; fn after_split(&self, t: Self::Scalar) -> Self; fn split_range(&self, t_range: Range<Self::Scalar>) -> Self; fn flip(&self) -> Self; fn approximate_length(&self, tolerance: Self::Scalar) -> Self::Scalar; fn x(&self, t: Self::Scalar) -> Self::Scalar { ... } fn y(&self, t: Self::Scalar) -> Self::Scalar { ... } fn dx(&self, t: Self::Scalar) -> Self::Scalar { ... } fn dy(&self, t: Self::Scalar) -> Self::Scalar { ... }
}
Expand description

Common APIs to segment types.

Required Associated Types

Required Methods

Start of the curve.

End of the curve.

Sample the curve at t (expecting t between 0 and 1).

Sample the derivative at t (expecting t between 0 and 1).

Split this curve into two sub-curves.

Return the curve before the split point.

Return the curve after the split point.

Return the curve inside a given range of t.

This is equivalent splitting at the range’s end points.

Swap the direction of the segment.

Compute the length of the segment using a flattened approximation.

Provided Methods

Sample x at t (expecting t between 0 and 1).

Sample y at t (expecting t between 0 and 1).

Sample x derivative at t (expecting t between 0 and 1).

Sample y derivative at t (expecting t between 0 and 1).

Implementors