pub trait SpatialAccess:
Send
+ Sync
+ 'static {
type Point: SpatialPoint;
type Comp: TComp;
type ResultT;
// Required methods
fn nearest_neighbour(
&self,
loc: <Self::Point as SpatialPoint>::Vec,
) -> Option<Self::ResultT>;
fn k_nearest_neighbour(
&self,
loc: <Self::Point as SpatialPoint>::Vec,
k: usize,
) -> Vec<Self::ResultT>;
fn within_distance(
&self,
loc: <Self::Point as SpatialPoint>::Vec,
distance: <Self::Point as SpatialPoint>::Scalar,
) -> Vec<Self::ResultT>;
}
Expand description
Trait for accessing point-based spatial datastructures.
Required Associated Types§
Sourcetype Point: SpatialPoint
type Point: SpatialPoint
The point type, can be anything implementing SpatialPoint
.
Required Methods§
Sourcefn nearest_neighbour(
&self,
loc: <Self::Point as SpatialPoint>::Vec,
) -> Option<Self::ResultT>
fn nearest_neighbour( &self, loc: <Self::Point as SpatialPoint>::Vec, ) -> Option<Self::ResultT>
Get the nearest neighbour to loc
.
Be aware that that distance to the returned point will be zero if loc
is part of the datastructure.
Sourcefn k_nearest_neighbour(
&self,
loc: <Self::Point as SpatialPoint>::Vec,
k: usize,
) -> Vec<Self::ResultT>
fn k_nearest_neighbour( &self, loc: <Self::Point as SpatialPoint>::Vec, k: usize, ) -> Vec<Self::ResultT>
Return the k nearest neighbours to loc
.
Sourcefn within_distance(
&self,
loc: <Self::Point as SpatialPoint>::Vec,
distance: <Self::Point as SpatialPoint>::Scalar,
) -> Vec<Self::ResultT>
fn within_distance( &self, loc: <Self::Point as SpatialPoint>::Vec, distance: <Self::Point as SpatialPoint>::Scalar, ) -> Vec<Self::ResultT>
Return all points which are within the specified distance.