Trait envelope::Envelope
[−]
[src]
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; fn points(&'a self) -> Self::Points; 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::X: Sub<Output = Self::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>> { ... } }
Types that are representable as an Envelope.
Associated Types
type X: PartialEq + PartialOrd + Clone
type Y: PartialEq + Spatial
type Point: Point<X = Self::X, Y = Self::Y> + 'a
The Point
type which may be referenced and interpolated by the Envelope
.
type Points: Iterator<Item = &'a Self::Point> + ExactSizeIterator + DoubleEndedIterator + Clone + 'a
An iterator yielding references to Self::Point
s.
Required Methods
Provided Methods
fn point_idx_before(&'a self, x: Self::X) -> Option<usize>
The index of the Point
that comes directly before the given x
.
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
.
fn point_idx_after(&'a self, x: Self::X) -> Option<usize>
The index of the Point
that comes directly after the given x
.
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
.
fn point_before(&'a self, x: Self::X) -> Option<&'a Self::Point>
A reference to the first point that comes before the given x
.
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
.
fn point_before_with_idx(
&'a self,
x: Self::X
) -> Option<(usize, &'a Self::Point)>
&'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.
fn point_on_or_before_with_idx(
&'a self,
x: Self::X
) -> Option<(usize, &'a Self::Point)>
&'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.
fn point_after(&'a self, x: Self::X) -> Option<&'a Self::Point>
A reference to the first point that comes after the given x
.
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
.
fn point_after_with_idx(
&'a self,
x: Self::X
) -> Option<(usize, &'a Self::Point)>
&'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.
fn point_on_or_after_with_idx(
&'a self,
x: Self::X
) -> Option<(usize, &'a Self::Point)>
&'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.
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.
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.
fn surrounding_points(
&'a self,
x: Self::X
) -> (Option<&'a Self::Point>, Option<&'a Self::Point>)
&'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.
fn closest_point(&'a self, x: Self::X) -> Option<&'a Self::Point> where
Self::X: Sub<Output = Self::X>,
Self::X: Sub<Output = Self::X>,
A reference point that is closest to the given x
if there is one.
FIXME: This could be much faster.
fn y(&'a self, x: Self::X) -> Option<Self::Y> where
<Self::Y as Spatial>::Scalar: Scalar,
<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
.
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.