Struct building_blocks::prelude::OctreeSet [−][src]
pub struct OctreeSet { /* fields omitted */ }
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
Make an empty set in the universe (domain) of extent
.
Make a full set in the universe (domain) of extent
.
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.
The length of any edge of the root octant.
pub 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
.
pub 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
.
Same as visit_branches_and_fat_leaves_in_preorder
, but descendants of fat leaves are also visited.
pub 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.
pub 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
.
pub 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
.
pub 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.
pub 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.
The OctreeNode
of the root, if it exists.
Returns the child OctreeNode
of parent
at the given child_index
, where 0 < child_octant < 8
.
Add all points from extent
to the set.
Subtract all points from extent
from the set.
Trait Implementations
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<OctreeSet, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<OctreeSet, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for OctreeSet
impl UnwindSafe for OctreeSet
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert 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
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Compare self to key
and return true
if they are equal.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.