Struct ncollide2d::partitioning::BVT
source · pub struct BVT<B, BV> { /* private fields */ }
Expand description
A Bounding Volume Tree.
Implementations§
source§impl<B, BV> BVT<B, BV>
impl<B, BV> BVT<B, BV>
sourcepub fn new_with_partitioner<F: FnMut(usize, Vec<(B, BV)>) -> (BV, BinaryPartition<B, BV>)>(
leaves: Vec<(B, BV)>,
partitioner: &mut F
) -> BVT<B, BV>
pub fn new_with_partitioner<F: FnMut(usize, Vec<(B, BV)>) -> (BV, BinaryPartition<B, BV>)>(
leaves: Vec<(B, BV)>,
partitioner: &mut F
) -> BVT<B, BV>
Builds a bounding volume tree using an user-defined construction function.
sourcepub fn visit<Vis: BVTVisitor<B, BV>>(&self, visitor: &mut Vis)
pub fn visit<Vis: BVTVisitor<B, BV>>(&self, visitor: &mut Vis)
Traverses this tree using an object implementing the BVTVisitor
trait.
This will traverse the whole tree and call the visitor .visit_internal(...)
(resp.
.visit_leaf(...)
) method on each internal (resp. leaf) node.
sourcepub fn visit_bvtt<Vis: BVTTVisitor<B, BV>>(
&self,
other: &BVT<B, BV>,
visitor: &mut Vis
)
pub fn visit_bvtt<Vis: BVTTVisitor<B, BV>>(
&self,
other: &BVT<B, BV>,
visitor: &mut Vis
)
Visits the bounding volume traversal tree implicitly formed with other
.
sourcepub fn best_first_search<'a, N, BFS>(
&'a self,
algorithm: &mut BFS
) -> Option<(&'a B, BFS::UserData)>where
N: Real,
BFS: BVTCostFn<N, B, BV>,
pub fn best_first_search<'a, N, BFS>(
&'a self,
algorithm: &mut BFS
) -> Option<(&'a B, BFS::UserData)>where
N: Real,
BFS: BVTCostFn<N, B, BV>,
Performs a best-fist-search on the tree.
Returns the content of the leaf with the smallest associated cost, and a result of user-defined type.
sourcepub fn root_bounding_volume<'r>(&'r self) -> Option<&'r BV>
pub fn root_bounding_volume<'r>(&'r self) -> Option<&'r BV>
Reference to the bounding volume of the tree root.
source§impl<B, BV> BVT<B, BV>
impl<B, BV> BVT<B, BV>
sourcepub fn new_balanced<N>(leaves: Vec<(B, BV)>) -> BVT<B, BV>where
N: Real,
BV: BoundingVolume<N> + Clone,
pub fn new_balanced<N>(leaves: Vec<(B, BV)>) -> BVT<B, BV>where
N: Real,
BV: BoundingVolume<N> + Clone,
Creates a balanced BVT
.
sourcepub fn median_partitioner_with_centers<N, F: FnMut(&B, &BV) -> Point<N>>(
depth: usize,
leaves: Vec<(B, BV)>,
center: &mut F
) -> (BV, BinaryPartition<B, BV>)where
N: Real,
BV: BoundingVolume<N> + Clone,
pub fn median_partitioner_with_centers<N, F: FnMut(&B, &BV) -> Point<N>>(
depth: usize,
leaves: Vec<(B, BV)>,
center: &mut F
) -> (BV, BinaryPartition<B, BV>)where
N: Real,
BV: BoundingVolume<N> + Clone,
Construction function for a kdree to be used with BVT::new_with_partitioner
.
sourcepub fn median_partitioner<N>(
depth: usize,
leaves: Vec<(B, BV)>
) -> (BV, BinaryPartition<B, BV>)where
N: Real,
BV: BoundingVolume<N> + Clone,
pub fn median_partitioner<N>(
depth: usize,
leaves: Vec<(B, BV)>
) -> (BV, BinaryPartition<B, BV>)where
N: Real,
BV: BoundingVolume<N> + Clone,
Construction function for a kdree to be used with BVT::new_with_partitioner
.
Trait Implementations§
Auto Trait Implementations§
impl<B, BV> RefUnwindSafe for BVT<B, BV>where
B: RefUnwindSafe,
BV: RefUnwindSafe,
impl<B, BV> Send for BVT<B, BV>where
B: Send,
BV: Send,
impl<B, BV> Sync for BVT<B, BV>where
B: Sync,
BV: Sync,
impl<B, BV> Unpin for BVT<B, BV>where
B: Unpin,
BV: Unpin,
impl<B, BV> UnwindSafe for BVT<B, BV>where
B: UnwindSafe,
BV: UnwindSafe,
Blanket Implementations§
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>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.