Struct rstar::primitives::CachedEnvelope
source · pub struct CachedEnvelope<T: RTreeObject> { /* private fields */ }
Expand description
An RTreeObject with an inner geometry whose envelope is cached to improve efficiency.
For complex geometry like polygons, computing the envelope can become a bottleneck during tree construction and querying. Hence this combinator computes it once during creation, stores it and then returns a copy.
Note: the container itself implements RTreeObject and inner geometry T
can be
accessed via an implementation of Deref<Target=T>
.
Implementations§
source§impl<T: RTreeObject> CachedEnvelope<T>
impl<T: RTreeObject> CachedEnvelope<T>
sourcepub fn new(inner: T) -> Self
pub fn new(inner: T) -> Self
Create a new CachedEnvelope struct using the provided geometry.
Trait Implementations§
source§impl<T: Clone + RTreeObject> Clone for CachedEnvelope<T>where
T::Envelope: Clone,
impl<T: Clone + RTreeObject> Clone for CachedEnvelope<T>where T::Envelope: Clone,
source§fn clone(&self) -> CachedEnvelope<T>
fn clone(&self) -> CachedEnvelope<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug + RTreeObject> Debug for CachedEnvelope<T>where
T::Envelope: Debug,
impl<T: Debug + RTreeObject> Debug for CachedEnvelope<T>where T::Envelope: Debug,
source§impl<T: Default + RTreeObject> Default for CachedEnvelope<T>where
T::Envelope: Default,
impl<T: Default + RTreeObject> Default for CachedEnvelope<T>where T::Envelope: Default,
source§fn default() -> CachedEnvelope<T>
fn default() -> CachedEnvelope<T>
Returns the “default value” for a type. Read more
source§impl<T: RTreeObject> Deref for CachedEnvelope<T>
impl<T: RTreeObject> Deref for CachedEnvelope<T>
source§impl<T: Hash + RTreeObject> Hash for CachedEnvelope<T>where
T::Envelope: Hash,
impl<T: Hash + RTreeObject> Hash for CachedEnvelope<T>where T::Envelope: Hash,
source§impl<T: Ord + RTreeObject> Ord for CachedEnvelope<T>where
T::Envelope: Ord,
impl<T: Ord + RTreeObject> Ord for CachedEnvelope<T>where T::Envelope: Ord,
source§fn cmp(&self, other: &CachedEnvelope<T>) -> Ordering
fn cmp(&self, other: &CachedEnvelope<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T: PartialEq + RTreeObject> PartialEq<CachedEnvelope<T>> for CachedEnvelope<T>where
T::Envelope: PartialEq,
impl<T: PartialEq + RTreeObject> PartialEq<CachedEnvelope<T>> for CachedEnvelope<T>where T::Envelope: PartialEq,
source§fn eq(&self, other: &CachedEnvelope<T>) -> bool
fn eq(&self, other: &CachedEnvelope<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<T: PartialOrd + RTreeObject> PartialOrd<CachedEnvelope<T>> for CachedEnvelope<T>where
T::Envelope: PartialOrd,
impl<T: PartialOrd + RTreeObject> PartialOrd<CachedEnvelope<T>> for CachedEnvelope<T>where T::Envelope: PartialOrd,
source§fn partial_cmp(&self, other: &CachedEnvelope<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &CachedEnvelope<T>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<T: PointDistance> PointDistance for CachedEnvelope<T>
impl<T: PointDistance> PointDistance for CachedEnvelope<T>
source§fn distance_2(
&self,
point: &<Self::Envelope as Envelope>::Point
) -> <<Self::Envelope as Envelope>::Point as Point>::Scalar
fn distance_2( &self, point: &<Self::Envelope as Envelope>::Point ) -> <<Self::Envelope as Envelope>::Point as Point>::Scalar
Returns the squared euclidean distance between an object to a point.
source§fn contains_point(&self, p: &<Self::Envelope as Envelope>::Point) -> bool
fn contains_point(&self, p: &<Self::Envelope as Envelope>::Point) -> bool
Returns
true
if a point is contained within this object. Read moresource§fn distance_2_if_less_or_equal(
&self,
point: &<Self::Envelope as Envelope>::Point,
max_distance_2: <<Self::Envelope as Envelope>::Point as Point>::Scalar
) -> Option<<<Self::Envelope as Envelope>::Point as Point>::Scalar>
fn distance_2_if_less_or_equal( &self, point: &<Self::Envelope as Envelope>::Point, max_distance_2: <<Self::Envelope as Envelope>::Point as Point>::Scalar ) -> Option<<<Self::Envelope as Envelope>::Point as Point>::Scalar>
Returns the squared distance to this object, or
None
if the distance
is larger than a given maximum value. Read moresource§impl<T: RTreeObject> RTreeObject for CachedEnvelope<T>where
T::Envelope: Clone,
impl<T: RTreeObject> RTreeObject for CachedEnvelope<T>where T::Envelope: Clone,
impl<T: Copy + RTreeObject> Copy for CachedEnvelope<T>where T::Envelope: Copy,
impl<T: Eq + RTreeObject> Eq for CachedEnvelope<T>where T::Envelope: Eq,
impl<T: RTreeObject> StructuralEq for CachedEnvelope<T>
impl<T: RTreeObject> StructuralPartialEq for CachedEnvelope<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for CachedEnvelope<T>where T: RefUnwindSafe, <T as RTreeObject>::Envelope: RefUnwindSafe,
impl<T> Send for CachedEnvelope<T>where T: Send, <T as RTreeObject>::Envelope: Send,
impl<T> Sync for CachedEnvelope<T>where T: Sync, <T as RTreeObject>::Envelope: Sync,
impl<T> Unpin for CachedEnvelope<T>where T: Unpin, <T as RTreeObject>::Envelope: Unpin,
impl<T> UnwindSafe for CachedEnvelope<T>where T: UnwindSafe, <T as RTreeObject>::Envelope: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more