Struct pasture_core::math::DynamicMortonIndex[][src]

pub struct DynamicMortonIndex { /* fields omitted */ }

3D Morton index with a dynamic depth

Implementations

impl DynamicMortonIndex[src]

pub fn from_octants(octants: &[Octant]) -> Self[src]

Creates a new DynamicMortonIndex from the given octants. The order of the octant numbering is unspecified. The order of the indices goes from shallowest node to deepest node.

Example:

let mut dynamic_morton_index = DynamicMortonIndex::from_octants(&[Octant::ONE, Octant::TWO, Octant::FOUR]);
assert_eq!(3, dynamic_morton_index.depth());

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

Returns the depth of the associated DynamicMortonIndex. A depth of zero corresponds to the root node of an octree

pub fn octants(&self) -> &[Octant][src]

Returns a reference to the octant indices of associated DynamicMortonIndex. The order of the indices goes from shallowest node to deepest node.

pub fn add_octant(&mut self, octant: Octant)[src]

Adds a new octant to the associated DynamicMortonIndex

Example:

let mut dynamic_morton_index = DynamicMortonIndex::from_octants(&[Octant::ONE, Octant::TWO, Octant::FOUR]);
dynamic_morton_index.add_octant(Octant::SIX);
assert_eq!(4, dynamic_morton_index.depth());
assert_eq!(&[Octant::ONE, Octant::TWO, Octant::FOUR, Octant::SIX], dynamic_morton_index.octants());

pub fn truncate_to_depth(&self, new_depth: usize) -> Option<Self>[src]

Tries to truncate the associated DynamicMortonIndex to the given depth. If depth is greater than the current depth, this operation fails and returns None.

Example:

let mut dynamic_morton_index = DynamicMortonIndex::from_octants(&[Octant::ONE, Octant::TWO, Octant::FOUR]);
let truncated_index = dynamic_morton_index.truncate_to_depth(1);
assert_eq!(Some(DynamicMortonIndex::from_octants(&[Octant::ONE])), truncated_index);

let invalid_index = dynamic_morton_index.truncate_to_depth(10);
assert_eq!(None, invalid_index);

pub fn iter(&self) -> impl Iterator<Item = &Octant>[src]

Returns an iterator over the octants in the associated DynamicMortonIndex

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Octant>[src]

Returns a mutable iterator over the octants in the associated DynamicMortonIndex

pub fn to_string(&self, naming: MortonIndexNaming) -> String[src]

Returns a string representation of the associated MortonIndex64 with the given MortonIndexNaming

Trait Implementations

impl Clone for DynamicMortonIndex[src]

impl Debug for DynamicMortonIndex[src]

impl Default for DynamicMortonIndex[src]

impl Display for DynamicMortonIndex[src]

impl Eq for DynamicMortonIndex[src]

impl From<&'_ MortonIndex64WithDepth> for DynamicMortonIndex[src]

impl From<MortonIndex64> for DynamicMortonIndex[src]

impl From<MortonIndex64WithDepth> for DynamicMortonIndex[src]

impl PartialEq<DynamicMortonIndex> for DynamicMortonIndex[src]

impl StructuralEq for DynamicMortonIndex[src]

impl StructuralPartialEq for DynamicMortonIndex[src]

impl TryFrom<&'_ DynamicMortonIndex> for MortonIndex64WithDepth[src]

type Error = DynamicMortonIndexTooLargeError

The type returned in the event of a conversion error.

impl TryFrom<DynamicMortonIndex> for MortonIndex64WithDepth[src]

type Error = DynamicMortonIndexTooLargeError

The type returned in the event of a conversion error.

Auto Trait Implementations

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> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,