Struct dmc::octree::MortonKey[][src]

pub struct MortonKey(pub u64);

A 64-bit integer that indicates a single node in a hashed octree. Its internal representation starts with 1 as the root node and appends 3 bits for each following child node, indicating its position in the X, Y and Z axis.

Implementations

impl MortonKey[src]

pub const fn root() -> Self[src]

Returns a Morton key pointing to the octree root node.

pub const fn none() -> Self[src]

Returns a Morton key pointing to no node.

pub fn parent(self) -> Self[src]

Returns the parent of this Morton key. If this key is pointing to the root node, the node given will be equal to MortonKey::none().

pub fn child(self, index: OctreeIndex) -> Self[src]

Returns a child of the node this key is pointing to.

Panics

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

pub fn level(self) -> u32[src]

Returns the level or depth of this node, where 0 is the root node.

Panics

Panics if this is a Morton key pointing to no node.

pub const fn max_level() -> u32[src]

Returns the maximum depth of the nodes that this type can point to.

pub fn position(self) -> Point3<f32>[src]

Returns the position of the center of the node this key is pointing to. All axis are in the (0, 1) interval.

pub fn closest_to_position(position: Point3<f32>, level: u32) -> Self[src]

Returns the Morton key with level level of an octree of bounds [-1]³ to [1]³ which is closest to the position position.

Panics

Panics if level < Self::max_level().

pub fn until_level(self, level: u32) -> Self[src]

Returns a key that goes along the current key until a given level.

Panics

If self.level() < level.

Trait Implementations

impl Clone for MortonKey[src]

impl Copy for MortonKey[src]

impl Debug for MortonKey[src]

impl Eq for MortonKey[src]

impl Hash for MortonKey[src]

impl PartialEq<MortonKey> for MortonKey[src]

impl StructuralEq for MortonKey[src]

impl StructuralPartialEq for MortonKey[src]

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> CallHasher for T where
    T: Hash + ?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.