pub struct Octree { /* private fields */ }Expand description
The Octree data structure for 3D spatial searches
Implementations§
Source§impl Octree
impl Octree
Sourcepub fn new(points: &ArrayView2<'_, f64>) -> SpatialResult<Self>
pub fn new(points: &ArrayView2<'_, f64>) -> SpatialResult<Self>
Sourcepub fn query_nearest(
&self,
query: &ArrayView1<'_, f64>,
k: usize,
) -> SpatialResult<(Vec<usize>, Vec<f64>)>
pub fn query_nearest( &self, query: &ArrayView1<'_, f64>, k: usize, ) -> SpatialResult<(Vec<usize>, Vec<f64>)>
Query the k nearest neighbors to a given point
§Arguments
query- The query pointk- The number of nearest neighbors to find
§Returns
A tuple of (indices, distances) where:
- indices: Indices of the k nearest points in the original data
- distances: Squared distances to those points
§Errors
Returns an error if the query point doesn’t have 3 dimensions or if k is 0
Sourcepub fn query_radius(
&self,
query: &ArrayView1<'_, f64>,
radius: f64,
) -> SpatialResult<(Vec<usize>, Vec<f64>)>
pub fn query_radius( &self, query: &ArrayView1<'_, f64>, radius: f64, ) -> SpatialResult<(Vec<usize>, Vec<f64>)>
Query all points within a given radius of a point
§Arguments
query- The query pointradius- The search radius
§Returns
A tuple of (indices, distances) where:
- indices: Indices of the points within the radius in the original data
- distances: Squared distances to those points
§Errors
Returns an error if the query point doesn’t have 3 dimensions or if radius is negative
Sourcepub fn check_collision(
&self,
other_points: &ArrayView2<'_, f64>,
collision_threshold: f64,
) -> SpatialResult<bool>
pub fn check_collision( &self, other_points: &ArrayView2<'_, f64>, collision_threshold: f64, ) -> SpatialResult<bool>
Check for collisions between two objects represented by point clouds
§Arguments
other_points- Points of the other objectcollision_threshold- Maximum distance for points to be considered colliding
§Returns
True if any point in other_points is within collision_threshold of any point in this octree
§Errors
Returns an error if other_points doesn’t have 3 dimensions or if collision_threshold is negative
Sourcepub fn bounds(&self) -> Option<BoundingBox>
pub fn bounds(&self) -> Option<BoundingBox>
Get the bounding box of the octree
§Returns
The bounding box of the entire octree, or None if the tree is empty
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Octree
impl RefUnwindSafe for Octree
impl Send for Octree
impl Sync for Octree
impl Unpin for Octree
impl UnwindSafe for Octree
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.