pub struct Octree<T, Idx: TreeIndex> { /* private fields */ }
Expand description

A data structure for partitioning data in a 3D space.

Implementations

Collapse a branch into a leaf by merging all descendant leaf data.

All merges occur between leaf data at the same depth.

Return the merged leaf data of the descendants of a specific branch.

Return the merged leaf data at a specific point.

The maximum grid size representable by this Octree

Construct a new tree with a void root.

The depth of the node at a specified index.

Panics
  • nodeself.proxies

The depth of the node at a specified index.

Divide a voxel into a branch, returning the indices of the new branch’s children.

If the target voxel is already a branch, no changes are made and the existing branch’s children are returned.

The children of a branch are always stored and given in Octant order.

Clear a voxel and clean up any data it represented. Leaf data is returned as a Vec, if any is removed.

If the voxel is a branch, the branch’s children are voided as well.

Set the leaf data of a voxel and, if extant, return its previous leaf data.

If the voxel is a branch, the branch is voided first.

Grow a tree by adding a parent branch to the old root. The old root becomes the octth child of the new root.

See Also

Get the index of the deepest voxel encompassing a specific VoxelPoint.

Panics
  • p ∉ 0..self.grid_size()

Get the index of the deepest voxel encompassing a specific VoxelPoint.

Errors
  • p ∉ 0..self.grid_size()

Get the index of the deepest voxel encompassing a specific NodePoint.

Convert this tree to one with a wider index type.

Clean proxy & leaf data by removing empty entries and updating stored indices.

Defragment & reallocate self such that only enough memory to store self is allocated.

Iterate through all leaf data, from oldest to newest.

Calculate the NodePoint of a specific node.

Self::graft, without error checks.

Panics
  • nodeself.proxies

Merge another tree as a branch of this tree.

node must be the index of a ProxyData::Void node.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

The number of divisions within this octree.

This can be used to determine the dimensions of the voxel grid represented by the tree.

Examples

If self consists only of one node (the root), its height is 0. If the root is a branch, and each child of the root is a leaf (or void), then the tree’s height is 1. If the root branch has a terminal child branch, the tree’s height is 2.

Index of the root node.
The height of a subtree, originating at a specific node.
Depth-first iterator through all leafs, from deepest to shallowest & nearest to farthest (by Octant ordering). Read more
The dimensions of the cubical voxel grid represented by this tree, as determined by the tree’s height. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Converts self into T using Into<T>. Read more
Causes self to use its Binary implementation when Debug-formatted. Read more
Causes self to use its Display implementation when Debug-formatted. Read more
Causes self to use its LowerExp implementation when Debug-formatted. Read more
Causes self to use its LowerHex implementation when Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted. Read more
Causes self to use its Pointer implementation when Debug-formatted. Read more
Causes self to use its UpperExp implementation when Debug-formatted. Read more
Causes self to use its UpperHex implementation when Debug-formatted. Read more
Formats each item in a sequence. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
Attempts to convert self into T using TryInto<T>. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.