Skip to main content

SegmentedPath

Trait SegmentedPath 

Source
pub trait SegmentedPath: Path {
    type Segment: PathSegment<Scalar = Self::Scalar, Point = Self::Point, Error = Self::Error>;

    // Required methods
    fn segment_count(&self) -> usize;
    fn segments(&self) -> impl Iterator<Item = &Self::Segment> + '_;
    fn locate(
        &self,
        s: Self::Scalar,
    ) -> Result<(usize, Self::Scalar), Self::Error>;

    // Provided method
    fn segment(&self, i: usize) -> Option<&Self::Segment> { ... }
}
Expand description

A path made up of multiple PathSegments.

Provides methods to enumerate segments, access them by index, and map a global arc-length parameter to a (segment_index, local_s) pair.

Required Associated Types§

Source

type Segment: PathSegment<Scalar = Self::Scalar, Point = Self::Point, Error = Self::Error>

The type of individual segments making up this path.

Required Methods§

Source

fn segment_count(&self) -> usize

Number of segments in this path.

Source

fn segments(&self) -> impl Iterator<Item = &Self::Segment> + '_

Iterator over all segments.

Source

fn locate(&self, s: Self::Scalar) -> Result<(usize, Self::Scalar), Self::Error>

Map global arc-length s to (segment_index, local_s).

Returns the index of the segment containing s and the local arc-length within that segment. Errors when s is outside the path’s domain.

Provided Methods§

Source

fn segment(&self, i: usize) -> Option<&Self::Segment>

Get the segment at index i, or None if out of bounds.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<A, B> SegmentedPath for Concat<A, B>
where A: Path + SegmentedPath, B: Path<Scalar = A::Scalar, Point = A::Point, Error = A::Error> + SegmentedPath<Segment = A::Segment>, A::Segment: PathSegment<Scalar = A::Scalar, Point = A::Point, Error = A::Error>,