Skip to main content

ParametricPath

Trait ParametricPath 

Source
pub trait ParametricPath: Path {
    // Required method
    fn sample_t(&self, t: Self::Scalar) -> Result<Self::Point, Self::Error>;

    // Provided methods
    fn t_to_s(&self, t: Self::Scalar) -> Self::Scalar { ... }
    fn s_to_t(&self, s: Self::Scalar) -> Self::Scalar { ... }
}
Expand description

A curve that also supports sampling by a normalized parameter t ∈ [0, 1].

Extends Path with sample_t(t). Default implementations of t_to_s and s_to_t use linear conversion (s = t * length), which is exact only for arc-length-parameterized paths. Implementers may override these for exact conversions.

Required Methods§

Source

fn sample_t(&self, t: Self::Scalar) -> Result<Self::Point, Self::Error>

Sample the path at normalized parameter t ∈ [0, 1].

Returns an error when t is outside the valid domain.

Provided Methods§

Source

fn t_to_s(&self, t: Self::Scalar) -> Self::Scalar

Convert normalized parameter t to arc-length s.

Default: t * length(). Override for exact conversions.

Source

fn s_to_t(&self, s: Self::Scalar) -> Self::Scalar

Convert arc-length s to normalized parameter t.

Default: s / length(). Override for exact conversions.

Implementors§