pub struct OctreeSet { /* private fields */ }Expand description
A sparse set of voxel coordinates (3D integer points). Supports spatial queries.
The octree is a cube shape and the edge lengths can only be a power of 2, at most 64.
Implementations§
Source§impl OctreeSet
impl OctreeSet
Sourcepub fn new_empty(extent: ExtentN<[i32; 3]>) -> OctreeSet
pub fn new_empty(extent: ExtentN<[i32; 3]>) -> OctreeSet
Make an empty set in the universe (domain) of extent.
Sourcepub fn new_full(extent: ExtentN<[i32; 3]>) -> OctreeSet
pub fn new_full(extent: ExtentN<[i32; 3]>) -> OctreeSet
Make a full set in the universe (domain) of extent.
Sourcepub fn from_array3<A, T>(array: &A, extent: ExtentN<[i32; 3]>) -> OctreeSet
pub fn from_array3<A, T>(array: &A, extent: ExtentN<[i32; 3]>) -> OctreeSet
Constructs an OctreeSet which contains all of the points in extent which are not empty (as defined by the IsEmpty
trait). extent must be cube-shaped with edge length being a power of 2. For power P where edge length is 2^P, we
must have 0 < P <= 6, because there is a maximum fixed depth of the octree.
Sourcepub fn edge_length(&self) -> i32
pub fn edge_length(&self) -> i32
The length of any edge of the root octant.
Sourcepub fn visit_branches_and_fat_leaves_for_extent_in_preorder(
&self,
extent: &ExtentN<[i32; 3]>,
visitor: &mut impl OctreeVisitor,
) -> VisitStatus
pub fn visit_branches_and_fat_leaves_for_extent_in_preorder( &self, extent: &ExtentN<[i32; 3]>, visitor: &mut impl OctreeVisitor, ) -> VisitStatus
Same as visit_branches_and_fat_leaves_in_preorder, but visit only the octants that overlap extent.
Sourcepub fn visit_branches_and_fat_leaves_for_extent_in_postorder(
&self,
extent: &ExtentN<[i32; 3]>,
visitor: &mut impl OctreeVisitor,
) -> VisitStatus
pub fn visit_branches_and_fat_leaves_for_extent_in_postorder( &self, extent: &ExtentN<[i32; 3]>, visitor: &mut impl OctreeVisitor, ) -> VisitStatus
Same as visit_branches_and_fat_leaves_in_postorder, but visit only the octants that overlap extent.
Sourcepub fn visit_all_octants_in_preorder(
&self,
visitor: &mut impl OctreeVisitor,
) -> VisitStatus
pub fn visit_all_octants_in_preorder( &self, visitor: &mut impl OctreeVisitor, ) -> VisitStatus
Same as visit_branches_and_fat_leaves_in_preorder, but descendants of fat leaves are also visited.
Sourcepub fn visit_all_octants_in_postorder(
&self,
predicate: &impl Fn(&OctreeNode) -> bool,
visitor: &mut impl OctreeVisitor,
) -> VisitStatus
pub fn visit_all_octants_in_postorder( &self, predicate: &impl Fn(&OctreeNode) -> bool, visitor: &mut impl OctreeVisitor, ) -> VisitStatus
Same as visit_branches_and_fat_leaves_in_postorder, but descendants of fat leaves are also visited.
Sourcepub fn visit_all_octants_for_extent_in_preorder(
&self,
extent: &ExtentN<[i32; 3]>,
visitor: &mut impl OctreeVisitor,
) -> VisitStatus
pub fn visit_all_octants_for_extent_in_preorder( &self, extent: &ExtentN<[i32; 3]>, visitor: &mut impl OctreeVisitor, ) -> VisitStatus
Same as visit_all_octants_in_preorder, but only for octants overlapping extent.
Sourcepub fn visit_all_octants_for_extent_in_postorder(
&self,
extent: &ExtentN<[i32; 3]>,
visitor: &mut impl OctreeVisitor,
) -> VisitStatus
pub fn visit_all_octants_for_extent_in_postorder( &self, extent: &ExtentN<[i32; 3]>, visitor: &mut impl OctreeVisitor, ) -> VisitStatus
Same as visit_all_octants_in_postorder, but only for octants overlapping extent.
Sourcepub fn visit_branches_and_fat_leaves_in_preorder(
&self,
visitor: &mut impl OctreeVisitor,
) -> VisitStatus
pub fn visit_branches_and_fat_leaves_in_preorder( &self, visitor: &mut impl OctreeVisitor, ) -> VisitStatus
Visit every branch and fat leaf in the octree. This is a pre-order traversal.
Sourcepub fn visit_branches_and_fat_leaves_in_postorder(
&self,
predicate: &impl Fn(&OctreeNode) -> bool,
visitor: &mut impl OctreeVisitor,
) -> VisitStatus
pub fn visit_branches_and_fat_leaves_in_postorder( &self, predicate: &impl Fn(&OctreeNode) -> bool, visitor: &mut impl OctreeVisitor, ) -> VisitStatus
Visit every branch and fat leaf in the octree. This is a post-order traversal.
Sourcepub fn root_node(&self) -> Option<OctreeNode>
pub fn root_node(&self) -> Option<OctreeNode>
The OctreeNode of the root, if it exists.
Sourcepub fn get_child(
&self,
parent: &OctreeNode,
child_index: u8,
) -> Option<OctreeNode>
pub fn get_child( &self, parent: &OctreeNode, child_index: u8, ) -> Option<OctreeNode>
Returns the child OctreeNode of parent at the given child_index, where 0 < child_octant < 8.
Sourcepub fn add_extent(&mut self, add_extent: &ExtentN<[i32; 3]>)
pub fn add_extent(&mut self, add_extent: &ExtentN<[i32; 3]>)
Add all points from extent to the set.
Sourcepub fn subtract_extent(&mut self, sub_extent: &ExtentN<[i32; 3]>)
pub fn subtract_extent(&mut self, sub_extent: &ExtentN<[i32; 3]>)
Subtract all points from extent from the set.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for OctreeSet
impl<'de> Deserialize<'de> for OctreeSet
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<OctreeSet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<OctreeSet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for OctreeSet
impl Serialize for OctreeSet
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for OctreeSet
impl StructuralPartialEq for OctreeSet
Auto Trait Implementations§
impl Freeze for OctreeSet
impl RefUnwindSafe for OctreeSet
impl Send for OctreeSet
impl Sync for OctreeSet
impl Unpin for OctreeSet
impl UnwindSafe for OctreeSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.