Struct ami::Octree [−][src]
pub struct Octree<T: Collider> { /* fields omitted */ }
An octree is a DAG that can quickly search for points in 3D space.
The bounding box of the root node contains all points in the octree. If a point outside the bounding box is added, a new root node is created which contains the old root as one of its octants. This process is repeated until the point is contained.
The nodes are stored in a vector, and are indexed using a 32-bit node ID. This saves memory over using pointers on 64-bit systems. Node ID 1 is the first node in the vector.
Methods
impl<T> Octree<T> where
T: Collider,
[src]
impl<T> Octree<T> where
T: Collider,
pub fn new() -> Octree<T>
[src]
pub fn new() -> Octree<T>
Create a new octree
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Clear the octree.
pub fn add(&mut self, point: T) -> Id
[src]
pub fn add(&mut self, point: T) -> Id
Add a point in the octree
pub fn remove(&mut self, id: Id) -> T
[src]
pub fn remove(&mut self, id: Id) -> T
Remove a point from the octree
Trait Implementations
impl<T> Index<Id> for Octree<T> where
T: Collider,
[src]
impl<T> Index<Id> for Octree<T> where
T: Collider,
type Output = T
The returned type after indexing.
ⓘImportant traits for &'a mut Rfn index<'a>(&'a self, index: Id) -> &'a T
[src]
fn index<'a>(&'a self, index: Id) -> &'a T
Performs the indexing (container[index]
) operation.
impl<T> IndexMut<Id> for Octree<T> where
T: Collider,
[src]
impl<T> IndexMut<Id> for Octree<T> where
T: Collider,
ⓘImportant traits for &'a mut Rfn index_mut<'a>(&'a mut self, index: Id) -> &'a mut T
[src]
fn index_mut<'a>(&'a mut self, index: Id) -> &'a mut T
Performs the mutable indexing (container[index]
) operation.
impl<T> Display for Octree<T> where
T: Collider,
[src]
impl<T> Display for Octree<T> where
T: Collider,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T> Debug for Octree<T> where
T: Collider,
[src]
impl<T> Debug for Octree<T> where
T: Collider,