[−][src]Trait rstar::Envelope
An envelope type that encompasses some child nodes.
An envelope defines how different bounding boxes of inserted children in an r-tree can interact, e.g. how they can be merged or intersected. This trait is not meant to be implemented by the user. Currently, only one implementation exists (AABB)[struct.AABB.html] and should be used, but more implementations are possible.
Associated Types
Loading content...Required methods
fn new_empty() -> Self
Creates a new, empty envelope that does not encompass any child.
fn contains_point(&self, point: &Self::Point) -> bool
Returns true if a point is contained within this envelope.
fn contains_envelope(&self, aabb: &Self) -> bool
Returns true if another envelope is fully contained within self
.
fn merge(&mut self, other: &Self)
Extends self
to contain another envelope.
fn merged(&self, other: &Self) -> Self
Returns the minimal envelope containing self
and another envelope.
fn intersects(&self, other: &Self) -> bool
Sets self
to the intersection of self
and another envelope.
fn intersection_area(&self, other: &Self) -> <Self::Point as Point>::Scalar
Returns the area of the intersection of self
and another envelope.
fn area(&self) -> <Self::Point as Point>::Scalar
Returns this envelope's area. Must be at least 0.
fn distance_2(&self, point: &Self::Point) -> <Self::Point as Point>::Scalar
Returns the euclidean distance to the envelope's border.
fn min_max_dist_2(&self, point: &Self::Point) -> <Self::Point as Point>::Scalar
Returns the squared min-max distance, a concept that helps to find nearest neighbors efficiently.
Visually, if an AABB and a point are given, the min-max distance returns the distance at which we surely know an element must be present. This serves as an upper bound during nearest neighbor search.
References
Roussopoulos, Nick, Stephen Kelley, and Frédéric Vincent. "Nearest neighbor queries." ACM sigmod record. Vol. 24. No. 2. ACM, 1995.
fn center(&self) -> Self::Point
Returns the envelope's center point.
fn margin_value(&self) -> <Self::Point as Point>::Scalar
Returns a value proportional to the envelope's margin.
fn sort_envelopes<T: RTreeObject<Envelope = Self>>(
axis: usize,
envelopes: &mut [T]
)
axis: usize,
envelopes: &mut [T]
)
Sorts a given set of objects with envelopes along one of their axis.
fn partition_envelopes<T: RTreeObject<Envelope = Self>>(
axis: usize,
envelopes: &mut [T],
selection_size: usize
)
axis: usize,
envelopes: &mut [T],
selection_size: usize
)
Partitions objects with an envelopes along a certain axis.
After calling this, envelopes[0..selection_size] are all smaller than envelopes[selection_size + 1..].
Implementors
impl<P> Envelope for AABB<P> where
P: Point,
[src]
P: Point,
type Point = P
fn new_empty() -> Self
[src]
fn contains_point(&self, point: &P) -> bool
[src]
fn contains_envelope(&self, other: &Self) -> bool
[src]
fn merge(&mut self, other: &Self)
[src]
fn merged(&self, other: &Self) -> Self
[src]
fn intersects(&self, other: &Self) -> bool
[src]
fn area(&self) -> P::Scalar
[src]
fn distance_2(&self, point: &P) -> P::Scalar
[src]
fn min_max_dist_2(&self, point: &P) -> <P as Point>::Scalar
[src]
fn center(&self) -> Self::Point
[src]
fn intersection_area(&self, other: &Self) -> <Self::Point as Point>::Scalar
[src]
fn margin_value(&self) -> P::Scalar
[src]
fn sort_envelopes<T: RTreeObject<Envelope = Self>>(
axis: usize,
envelopes: &mut [T]
)
[src]
axis: usize,
envelopes: &mut [T]
)
fn partition_envelopes<T: RTreeObject<Envelope = Self>>(
axis: usize,
envelopes: &mut [T],
selection_size: usize
)
[src]
axis: usize,
envelopes: &mut [T],
selection_size: usize
)