Struct dmc::octree::HashedOctree [−][src]
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]
&self,
key: MortonKey
) -> Option<Ref<'_, MortonKey, T, RandomState>>
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]
&mut self,
key: MortonKey
) -> Option<RefMut<'_, MortonKey, T, RandomState>>
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]
&self,
key: MortonKey
) -> Option<impl Iterator<Item = MortonKey>>
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]
fn clone(&self) -> HashedOctree<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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,
T: Send,
impl<T> Sync for HashedOctree<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Unpin for HashedOctree<T>
impl<T> UnwindSafe for HashedOctree<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,