Struct dmc::octree::HashedOctree[][src]

pub struct HashedOctree<T: Copy> { /* fields omitted */ }

A hashed (linear) octree implementation which uses MortonKey for indexing. This type supports concurrent access and uses a fast hashing algorithm for best performance.

Example

use dmc::octree::*;

let mut octree = HashedOctree::new(0usize);

let mut i = 0;
octree.subdivide(MortonKey::root()).for_each(|child| {
    *octree.value_mut(child).unwrap() = i; i += 1;
});
dbg!(octree);

Implementations

impl<T: Copy> HashedOctree<T>[src]

pub fn new(root_value: T) -> Self[src]

Creates a new hashed octree, with a value for the root node.

pub fn value(
    &self,
    key: MortonKey
) -> Option<Ref<'_, MortonKey, T, RandomState>>
[src]

Returns a reference to a node if it exists.

Concurrent Behaviour

May deadlock if called when holding a mutable reference into the octree.

pub fn value_mut(
    &mut self,
    key: MortonKey
) -> Option<RefMut<'_, MortonKey, T, RandomState>>
[src]

Returns a mutable reference to a node if it exists.

Concurrent Behaviour

May deadlock if called when holding any sort of reference into the octree.

pub fn subdivide(&mut self, key: MortonKey) -> impl Iterator<Item = MortonKey>[src]

Subdivides a node and returns an iterator over its newly created children. The value of the children will be copied from the parent.

Panics

Panics if the node passed is already subdivided.

pub fn children(
    &self,
    key: MortonKey
) -> Option<impl Iterator<Item = MortonKey>>
[src]

Returns an iterator over the children of a node, or None if the children (or parent) don’t exist.

pub fn node_exists(&self, key: MortonKey) -> bool[src]

Returns true if a node exists.

pub fn is_subdivided(&self, key: MortonKey) -> bool[src]

Returns true if the children of a node exists.

Panics

Panics if the level of the key given is equal to the maximum level possible.

pub fn leaves(&self, parent: MortonKey) -> Vec<MortonKey>[src]

Finds all the leaf nodes belonging to parent and returns a vector with a key for each of them.

pub fn node_count(&self) -> usize[src]

Returns the total node count, including leaf and branch nodes.

Trait Implementations

impl<T: Clone + Copy> Clone for HashedOctree<T>[src]

impl<T: Debug + Copy> Debug for HashedOctree<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for HashedOctree<T>

impl<T> Send for HashedOctree<T> where
    T: Send

impl<T> Sync for HashedOctree<T> where
    T: Send + Sync

impl<T> Unpin for HashedOctree<T>

impl<T> UnwindSafe for HashedOctree<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.