Struct parry3d::partitioning::Qbvh
source · #[repr(C)]pub struct Qbvh<LeafData> { /* private fields */ }
Expand description
A quaternary bounding-volume-hierarchy.
This is a bounding-volume-hierarchy where each node has either four children or none.
Implementations§
source§impl<LeafData: IndexedData> Qbvh<LeafData>
impl<LeafData: IndexedData> Qbvh<LeafData>
sourcepub fn iter_data_mut(
&mut self
) -> impl Iterator<Item = (NodeIndex, &mut LeafData)>
pub fn iter_data_mut( &mut self ) -> impl Iterator<Item = (NodeIndex, &mut LeafData)>
Iterates mutably through all the leaf data in this Qbvh.
sourcepub fn iter_data(&self) -> impl Iterator<Item = (NodeIndex, &LeafData)>
pub fn iter_data(&self) -> impl Iterator<Item = (NodeIndex, &LeafData)>
Iterate through all the leaf data in this Qbvh.
sourcepub fn leaf_data(&self, node_id: NodeIndex) -> Option<LeafData>
pub fn leaf_data(&self, node_id: NodeIndex) -> Option<LeafData>
Returns the data associated to a given leaf.
Returns None
if the provided node ID does not identify a leaf.
sourcepub fn raw_nodes(&self) -> &[QbvhNode]
pub fn raw_nodes(&self) -> &[QbvhNode]
The raw nodes of this BVH.
If this Qbvh isn’t empty, the first element of the returned slice is the root of the tree. The other elements are not arranged in any particular order. The more high-level traversal methods should be used instead of this.
sourcepub fn raw_proxies(&self) -> &[QbvhProxy<LeafData>]
pub fn raw_proxies(&self) -> &[QbvhProxy<LeafData>]
The raw proxies of this BVH.
If this Qbvh isn’t empty, the first element of the returned slice is the root of the tree. The other elements are not arranged in any particular order. The more high-level traversal methods should be used instead of this.
source§impl<LeafData: IndexedData> Qbvh<LeafData>
impl<LeafData: IndexedData> Qbvh<LeafData>
source§impl<LeafData: IndexedData> Qbvh<LeafData>
impl<LeafData: IndexedData> Qbvh<LeafData>
sourcepub fn clear_and_rebuild(
&mut self,
data_gen: impl QbvhDataGenerator<LeafData>,
dilation_factor: Real
)
pub fn clear_and_rebuild( &mut self, data_gen: impl QbvhDataGenerator<LeafData>, dilation_factor: Real )
Clears this quaternary BVH and rebuilds it from a new set of data and Aabbs.
source§impl<LeafData: IndexedData> Qbvh<LeafData>
impl<LeafData: IndexedData> Qbvh<LeafData>
sourcepub fn clear_and_rebuild_with_splitter(
&mut self,
data_gen: impl QbvhDataGenerator<LeafData>,
splitter: impl QbvhDataSplitter<LeafData>,
dilation_factor: Real
)
pub fn clear_and_rebuild_with_splitter( &mut self, data_gen: impl QbvhDataGenerator<LeafData>, splitter: impl QbvhDataSplitter<LeafData>, dilation_factor: Real )
Clears this quaternary BVH and rebuilds it from a new set of data and Aabbs.
source§impl<LeafData: IndexedData> Qbvh<LeafData>
impl<LeafData: IndexedData> Qbvh<LeafData>
sourcepub fn traverse_depth_first(
&self,
visitor: &mut impl SimdVisitor<LeafData, SimdAabb>
) -> bool
pub fn traverse_depth_first( &self, visitor: &mut impl SimdVisitor<LeafData, SimdAabb> ) -> bool
Performs a depth-first traversal on the BVH.
§Return
Returns false
if the traversal exitted early, and true
otherwise.
sourcepub fn traverse_depth_first_node(
&self,
visitor: &mut impl SimdVisitor<LeafData, SimdAabb>,
start_node: u32
) -> bool
pub fn traverse_depth_first_node( &self, visitor: &mut impl SimdVisitor<LeafData, SimdAabb>, start_node: u32 ) -> bool
Performs a depth-first traversal on the BVH, starting at the given node.
§Return
Returns false
if the traversal exitted early, and true
otherwise.
sourcepub fn traverse_depth_first_with_stack(
&self,
visitor: &mut impl SimdVisitor<LeafData, SimdAabb>,
stack: &mut Vec<u32>
) -> bool
pub fn traverse_depth_first_with_stack( &self, visitor: &mut impl SimdVisitor<LeafData, SimdAabb>, stack: &mut Vec<u32> ) -> bool
Performs a depth-first traversal on the BVH.
§Return
Returns false
if the traversal exited early, and true
otherwise.
sourcepub fn traverse_depth_first_node_with_stack(
&self,
visitor: &mut impl SimdVisitor<LeafData, SimdAabb>,
stack: &mut Vec<u32>,
start_node: u32
) -> bool
pub fn traverse_depth_first_node_with_stack( &self, visitor: &mut impl SimdVisitor<LeafData, SimdAabb>, stack: &mut Vec<u32>, start_node: u32 ) -> bool
Performs a depth-first traversal on the BVH.
§Return
Returns false
if the traversal exited early, and true
otherwise.
sourcepub fn traverse_depth_first_with_context<Context: Clone>(
&self,
visitor: &mut impl SimdVisitorWithContext<LeafData, SimdAabb, Context>,
context: Context
) -> bool
pub fn traverse_depth_first_with_context<Context: Clone>( &self, visitor: &mut impl SimdVisitorWithContext<LeafData, SimdAabb, Context>, context: Context ) -> bool
Performs a depth-first traversal on the BVH. Passes a context from the parent to the children.
§Return
Returns false
if the traversal exitted early, and true
otherwise.
sourcepub fn traverse_depth_first_node_with_stack_and_context<Context: Clone>(
&self,
visitor: &mut impl SimdVisitorWithContext<LeafData, SimdAabb, Context>,
stack: &mut Vec<(u32, Context)>,
start_node: u32,
context: Context
) -> bool
pub fn traverse_depth_first_node_with_stack_and_context<Context: Clone>( &self, visitor: &mut impl SimdVisitorWithContext<LeafData, SimdAabb, Context>, stack: &mut Vec<(u32, Context)>, start_node: u32, context: Context ) -> bool
Performs a depth-first traversal on the BVH and propagates a context down, from the root to each of its descendants. The context can be modified during the query.
§Return
Returns false
if the traversal exited early, and true
otherwise.
sourcepub fn traverse_best_first<BFS>(
&self,
visitor: &mut BFS
) -> Option<(NodeIndex, BFS::Result)>
pub fn traverse_best_first<BFS>( &self, visitor: &mut BFS ) -> Option<(NodeIndex, BFS::Result)>
Performs a best-first-search on the BVH.
Returns the content of the leaf with the smallest associated cost, and a result of user-defined type.
sourcepub fn traverse_best_first_node<BFS>(
&self,
visitor: &mut BFS,
start_node: u32,
init_cost: Real
) -> Option<(NodeIndex, BFS::Result)>
pub fn traverse_best_first_node<BFS>( &self, visitor: &mut BFS, start_node: u32, init_cost: Real ) -> Option<(NodeIndex, BFS::Result)>
Performs a best-first-search on the BVH, starting at the given node.
Returns the content of the leaf with the smallest associated cost, and a result of user-defined type.
sourcepub fn intersect_aabb(&self, aabb: &Aabb, out: &mut Vec<LeafData>)
pub fn intersect_aabb(&self, aabb: &Aabb, out: &mut Vec<LeafData>)
Retrieve all the data of the nodes with Aabbs intersecting the given Aabb:
sourcepub fn traverse_bvtt<LeafData2: IndexedData>(
&self,
qbvh2: &Qbvh<LeafData2>,
visitor: &mut impl SimdSimultaneousVisitor<LeafData, LeafData2, SimdAabb>
)
pub fn traverse_bvtt<LeafData2: IndexedData>( &self, qbvh2: &Qbvh<LeafData2>, visitor: &mut impl SimdSimultaneousVisitor<LeafData, LeafData2, SimdAabb> )
Performs a simultaneous traversal of two Qbvh.
sourcepub fn traverse_bvtt_with_stack<LeafData2: IndexedData>(
&self,
qbvh2: &Qbvh<LeafData2>,
visitor: &mut impl SimdSimultaneousVisitor<LeafData, LeafData2, SimdAabb>,
stack: &mut Vec<(u32, u32)>
)
pub fn traverse_bvtt_with_stack<LeafData2: IndexedData>( &self, qbvh2: &Qbvh<LeafData2>, visitor: &mut impl SimdSimultaneousVisitor<LeafData, LeafData2, SimdAabb>, stack: &mut Vec<(u32, u32)> )
Performs a simultaneous traversal of two Qbvh.
sourcepub fn traverse_modified_bvtt<LeafData2: IndexedData>(
&self,
qbvh2: &Qbvh<LeafData2>,
visitor: &mut impl SimdSimultaneousVisitor<LeafData, LeafData2, SimdAabb>
)
pub fn traverse_modified_bvtt<LeafData2: IndexedData>( &self, qbvh2: &Qbvh<LeafData2>, visitor: &mut impl SimdSimultaneousVisitor<LeafData, LeafData2, SimdAabb> )
Performs a simultaneous traversal of two Qbvh.
sourcepub fn traverse_modified_bvtt_with_stack<LeafData2: IndexedData>(
&self,
qbvh2: &Qbvh<LeafData2>,
visitor: &mut impl SimdSimultaneousVisitor<LeafData, LeafData2, SimdAabb>,
stack: &mut Vec<(u32, u32)>
)
pub fn traverse_modified_bvtt_with_stack<LeafData2: IndexedData>( &self, qbvh2: &Qbvh<LeafData2>, visitor: &mut impl SimdSimultaneousVisitor<LeafData, LeafData2, SimdAabb>, stack: &mut Vec<(u32, u32)> )
Performs a simultaneous traversal of two Qbvh.
source§impl<LeafData: IndexedData> Qbvh<LeafData>
impl<LeafData: IndexedData> Qbvh<LeafData>
sourcepub fn remove(&mut self, data: LeafData) -> Option<LeafData>
pub fn remove(&mut self, data: LeafData) -> Option<LeafData>
Immediately remove a leaf from this QBVH.
sourcepub fn pre_update_or_insert(&mut self, data: LeafData)
pub fn pre_update_or_insert(&mut self, data: LeafData)
Prepare a new leaf for insertion into this QBVH (or for update if it already exists).
The insertion or update will be completely valid only after the next call to Qbvh::refit
.
sourcepub fn refit<F>(
&mut self,
margin: Real,
workspace: &mut QbvhUpdateWorkspace,
aabb_builder: F
) -> usize
pub fn refit<F>( &mut self, margin: Real, workspace: &mut QbvhUpdateWorkspace, aabb_builder: F ) -> usize
Update all the nodes that have been marked as dirty by Qbvh::pre_update_or_insert
,
and Qbvh::remove
.
This will not alter the topology of this Qbvh
.
sourcepub fn rebalance(&mut self, margin: Real, workspace: &mut QbvhUpdateWorkspace)
pub fn rebalance(&mut self, margin: Real, workspace: &mut QbvhUpdateWorkspace)
Rebalances the Qbvh
tree.
This will modify the topology of this tree. This assumes that the leaf AABBs have
already been updated with Qbvh::refit
.
Trait Implementations§
Auto Trait Implementations§
impl<LeafData> Freeze for Qbvh<LeafData>
impl<LeafData> RefUnwindSafe for Qbvh<LeafData>where
LeafData: RefUnwindSafe,
impl<LeafData> Send for Qbvh<LeafData>where
LeafData: Send,
impl<LeafData> Sync for Qbvh<LeafData>where
LeafData: Sync,
impl<LeafData> Unpin for Qbvh<LeafData>where
LeafData: Unpin,
impl<LeafData> UnwindSafe for Qbvh<LeafData>where
LeafData: UnwindSafe,
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> 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<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§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.