Envelope

Trait Envelope 

Source
pub trait Envelope<'a>: Sized {
    type X: PartialEq + PartialOrd + Clone;
    type Y: PartialEq + Spatial;
    type Point: Point<X = Self::X, Y = Self::Y> + 'a;
    type Points: Iterator<Item = &'a Self::Point> + ExactSizeIterator + DoubleEndedIterator + Clone + 'a;

Show 19 methods // Required method fn points(&'a self) -> Self::Points; // Provided methods fn point_idx_before(&'a self, x: Self::X) -> Option<usize> { ... } fn point_idx_on_or_before(&'a self, x: Self::X) -> Option<usize> { ... } fn point_idx_after(&'a self, x: Self::X) -> Option<usize> { ... } fn point_idx_on_or_after(&'a self, x: Self::X) -> Option<usize> { ... } fn point_before(&'a self, x: Self::X) -> Option<&'a Self::Point> { ... } fn point_on_or_before(&'a self, x: Self::X) -> Option<&'a Self::Point> { ... } fn point_before_with_idx( &'a self, x: Self::X, ) -> Option<(usize, &'a Self::Point)> { ... } fn point_on_or_before_with_idx( &'a self, x: Self::X, ) -> Option<(usize, &'a Self::Point)> { ... } fn point_after(&'a self, x: Self::X) -> Option<&'a Self::Point> { ... } fn point_on_or_after(&'a self, x: Self::X) -> Option<&'a Self::Point> { ... } fn point_after_with_idx( &'a self, x: Self::X, ) -> Option<(usize, &'a Self::Point)> { ... } fn point_on_or_after_with_idx( &'a self, x: Self::X, ) -> Option<(usize, &'a Self::Point)> { ... } fn point_at(&'a self, x: Self::X) -> Option<&'a Self::Point> { ... } fn point_at_with_idx( &'a self, x: Self::X, ) -> Option<(usize, &'a Self::Point)> { ... } fn surrounding_points( &'a self, x: Self::X, ) -> (Option<&'a Self::Point>, Option<&'a Self::Point>) { ... } fn closest_point(&'a self, x: Self::X) -> Option<&'a Self::Point> where <Self as Envelope<'a>>::X: Sub<Output = <Self as Envelope<'a>>::X> { ... } fn y(&'a self, x: Self::X) -> Option<Self::Y> where <Self::Y as Spatial>::Scalar: Scalar { ... } fn steps(&'a self, start: Self::X, step: Self::X) -> Option<Steps<'a, Self>> { ... }
}
Expand description

Types that are representable as an Envelope.

Required Associated Types§

Source

type X: PartialEq + PartialOrd + Clone

Source

type Y: PartialEq + Spatial

Source

type Point: Point<X = Self::X, Y = Self::Y> + 'a

The Point type which may be referenced and interpolated by the Envelope.

Source

type Points: Iterator<Item = &'a Self::Point> + ExactSizeIterator + DoubleEndedIterator + Clone + 'a

An iterator yielding references to Self::Points.

Required Methods§

Source

fn points(&'a self) -> Self::Points

An iterator yielding the Points of the Envelope.

Provided Methods§

Source

fn point_idx_before(&'a self, x: Self::X) -> Option<usize>

The index of the Point that comes directly before the given x.

Source

fn point_idx_on_or_before(&'a self, x: Self::X) -> Option<usize>

The index of the Point that either lands on or comes directly before the given x.

Source

fn point_idx_after(&'a self, x: Self::X) -> Option<usize>

The index of the Point that comes directly after the given x.

Source

fn point_idx_on_or_after(&'a self, x: Self::X) -> Option<usize>

The index of the Point that comes directly after the given x.

Source

fn point_before(&'a self, x: Self::X) -> Option<&'a Self::Point>

A reference to the first point that comes before the given x.

Source

fn point_on_or_before(&'a self, x: Self::X) -> Option<&'a Self::Point>

A reference to the first point that is equal to or comes before the given x.

Source

fn point_before_with_idx( &'a self, x: Self::X, ) -> Option<(usize, &'a Self::Point)>

A reference to the first point that comes before the given x along with its index.

Source

fn point_on_or_before_with_idx( &'a self, x: Self::X, ) -> Option<(usize, &'a Self::Point)>

A reference to the first point that is equal to or comes before the given x along with its index.

Source

fn point_after(&'a self, x: Self::X) -> Option<&'a Self::Point>

A reference to the first point that comes after the given x.

Source

fn point_on_or_after(&'a self, x: Self::X) -> Option<&'a Self::Point>

A reference to the first point that is equal to or comes after the given x.

Source

fn point_after_with_idx( &'a self, x: Self::X, ) -> Option<(usize, &'a Self::Point)>

A reference to the first point that comes after the given x along with its index.

Source

fn point_on_or_after_with_idx( &'a self, x: Self::X, ) -> Option<(usize, &'a Self::Point)>

A reference to the first point that is equal to or comes after the given x along with its index.

Source

fn point_at(&'a self, x: Self::X) -> Option<&'a Self::Point>

A reference to the first point lying directly on the given x if there is one.

Source

fn point_at_with_idx(&'a self, x: Self::X) -> Option<(usize, &'a Self::Point)>

A reference to the first point (along with it’s index) lying directly on the given x if there is one.

Source

fn surrounding_points( &'a self, x: Self::X, ) -> (Option<&'a Self::Point>, Option<&'a Self::Point>)

The points that lie on either side of the given x.

FIXME: This could be much faster.

Source

fn closest_point(&'a self, x: Self::X) -> Option<&'a Self::Point>
where <Self as Envelope<'a>>::X: Sub<Output = <Self as Envelope<'a>>::X>,

A reference point that is closest to the given x if there is one.

FIXME: This could be much faster.

Source

fn y(&'a self, x: Self::X) -> Option<Self::Y>
where <Self::Y as Spatial>::Scalar: Scalar,

Return y for the given x.

If there is less than two points interpolation is not meaningful, thus we should just return None.

Note: It is assumed that the points owned by the Envelope are sorted by x.

Source

fn steps(&'a self, start: Self::X, step: Self::X) -> Option<Steps<'a, Self>>

Sample the Envelope’s y value for every given positive x step starting from the first point’s X value.

The envelope will yield Some(Y) until the first step is out of range of all points on the y axis.

Returns None if start is outside the bounds of all points.

Note: This method assumes that the envelope points are ordered.

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§