Type Alias parry2d_f64::partitioning::Qbvh

source ·
pub type Qbvh<LeafData> = GenericQbvh<LeafData, DefaultStorage>;
Expand description

A quaternary bounding-volume-hierarchy.

This is a bounding-volume-hierarchy where each node has either four children or none.

Aliased Type§

struct Qbvh<LeafData> { /* private fields */ }

Implementations§

source§

impl<LeafData: IndexedData> Qbvh<LeafData>

source

pub fn new() -> Self

Initialize an empty Qbvh.

source

pub fn iter_data_mut( &mut self ) -> impl Iterator<Item = (NodeIndex, &mut LeafData)>

Iterates mutably through all the leaf data in this Qbvh.

source

pub fn iter_data(&self) -> impl Iterator<Item = (NodeIndex, &LeafData)>

Iterate through all the leaf data in this Qbvh.

source

pub fn node_aabb(&self, node_id: NodeIndex) -> Option<Aabb>

The Aabb of the given node.

source

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.

source

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.

source

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

pub fn scaled(self, scale: &Vector<Real>) -> Self

Computes a scaled version of this Qbvh.

This will apply the scale to each Aabb on this BVH.

source§

impl<LeafData: IndexedData> Qbvh<LeafData>

source

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>

source

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>

source

pub fn remove(&mut self, data: LeafData) -> Option<LeafData>

Immediately remove a leaf from this QBVH.

source

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.

source

pub fn refit<F>( &mut self, margin: Real, workspace: &mut QbvhUpdateWorkspace, aabb_builder: F ) -> usize
where F: Fn(&LeafData) -> Aabb,

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.

source

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.

source§

impl<LeafData: IndexedData, Storage: QbvhStorage<LeafData>> GenericQbvh<LeafData, Storage>

source

pub fn root_aabb(&self) -> &Aabb

The Aabb of the root of this tree.

source§

impl<LeafData: IndexedData, Storage: QbvhStorage<LeafData>> GenericQbvh<LeafData, Storage>

source

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.

source

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.

source

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.

source

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.

source

pub fn traverse_best_first<BFS>( &self, visitor: &mut BFS ) -> Option<(NodeIndex, BFS::Result)>
where BFS: SimdBestFirstVisitor<LeafData, SimdAabb>, BFS::Result: Clone,

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.

source

pub fn traverse_best_first_node<BFS>( &self, visitor: &mut BFS, start_node: u32, init_cost: Real ) -> Option<(NodeIndex, BFS::Result)>
where BFS: SimdBestFirstVisitor<LeafData, SimdAabb>, BFS::Result: Clone,

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.

source

pub fn intersect_aabb(&self, aabb: &Aabb, out: &mut Vec<LeafData>)

Retrieve all the data of the nodes with Aabbs intersecting the given Aabb:

source

pub fn traverse_bvtt<LeafData2: IndexedData>( &self, qbvh2: &Qbvh<LeafData2>, visitor: &mut impl SimdSimultaneousVisitor<LeafData, LeafData2, SimdAabb> )

Performs a simultaneous traversal of two Qbvh.

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl<LeafData: IndexedData> Default for Qbvh<LeafData>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<LeafData, Storage> Clone for GenericQbvh<LeafData, Storage>
where Storage: QbvhStorage<LeafData>, Storage::Nodes: Clone, Storage::ArrayU32: Clone, Storage::ArrayProxies: Clone,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<LeafData: Debug, Storage: Debug + QbvhStorage<LeafData>> Debug for GenericQbvh<LeafData, Storage>
where Storage::Nodes: Debug, Storage::ArrayU32: Debug, Storage::ArrayProxies: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<LeafData, Storage> Copy for GenericQbvh<LeafData, Storage>
where Storage: QbvhStorage<LeafData>, Storage::Nodes: Copy, Storage::ArrayU32: Copy, Storage::ArrayProxies: Copy,