KDTreeIndex

Trait KDTreeIndex 

Source
pub trait KDTreeIndex<N: IndexableNum>: Sized {
    // Required methods
    fn coords(&self) -> &[N];
    fn indices(&self) -> Indices<'_>;
    fn metadata(&self) -> &KDTreeMetadata<N>;

    // Provided methods
    fn num_items(&self) -> u32 { ... }
    fn node_size(&self) -> u16 { ... }
    fn range(&self, min_x: N, min_y: N, max_x: N, max_y: N) -> Vec<u32> { ... }
    fn range_rect(&self, rect: &impl RectTrait<T = N>) -> Vec<u32> { ... }
    fn within(&self, qx: N, qy: N, r: N) -> Vec<u32> { ... }
    fn within_coord(&self, coord: &impl CoordTrait<T = N>, r: N) -> Vec<u32> { ... }
    fn root(&self) -> Node<'_, N, Self> { ... }
}
Expand description

A trait for searching and accessing data out of a KDTree.

Required Methods§

Source

fn coords(&self) -> &[N]

The underlying raw coordinate buffer of this tree

Source

fn indices(&self) -> Indices<'_>

The underlying raw indices buffer of this tree

Source

fn metadata(&self) -> &KDTreeMetadata<N>

Access the metadata describing this KDTree

Provided Methods§

Source

fn num_items(&self) -> u32

The number of items in this KDTree

Source

fn node_size(&self) -> u16

The node size of this KDTree

Source

fn range(&self, min_x: N, min_y: N, max_x: N, max_y: N) -> Vec<u32>

Search the index for items within a given bounding box.

  • min_x: bbox
  • min_y: bbox
  • max_x: bbox
  • max_y: bbox

Returns indices of found items

Source

fn range_rect(&self, rect: &impl RectTrait<T = N>) -> Vec<u32>

Search the index for items within a given bounding box.

Returns indices of found items

Source

fn within(&self, qx: N, qy: N, r: N) -> Vec<u32>

Search the index for items within a given radius.

  • qx: x value of query point
  • qy: y value of query point
  • r: radius

Returns indices of found items

Source

fn within_coord(&self, coord: &impl CoordTrait<T = N>, r: N) -> Vec<u32>

Search the index for items within a given radius.

  • coord: coordinate of query point
  • r: radius

Returns indices of found items

Source

fn root(&self) -> Node<'_, N, Self>

Access the root node of the KDTree for manual traversal.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§