Trait SpatialAccess

Source
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§

Source

type Point: SpatialPoint

The point type, can be anything implementing SpatialPoint.

Source

type Comp: TComp

The marker component type marking the entities whos points are stored, used for accessing the component in trait bounds.

Source

type ResultT

The type of a single query result.

Required Methods§

Source

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.

Source

fn k_nearest_neighbour( &self, loc: <Self::Point as SpatialPoint>::Vec, k: usize, ) -> Vec<Self::ResultT>

Return the k nearest neighbours to loc.

Source

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.

Implementors§

Source§

impl<Comp> SpatialAccess for KDTree2<Comp>
where Comp: TComp,

Source§

impl<Comp> SpatialAccess for KDTree3<Comp>
where Comp: TComp,

Source§

impl<Comp> SpatialAccess for KDTree3A<Comp>
where Comp: TComp,

Source§

impl<Comp> SpatialAccess for KDTreeD2<Comp>
where Comp: TComp,

Source§

impl<Comp> SpatialAccess for KDTreeD3<Comp>
where Comp: TComp,