Struct oxygengine_physics_2d::prelude::ncollide2d::partitioning::BVT
source · pub struct BVT<T, BV> { /* private fields */ }
Expand description
A Bounding Volume Tree.
Implementations§
source§impl<T, BV> BVT<T, BV>
impl<T, BV> BVT<T, BV>
sourcepub fn new_with_partitioning<F>(
elements: Vec<(T, BV), Global>,
partitioning: &mut F
) -> BVT<T, BV>where
F: FnMut(usize, Vec<(T, BV), Global>) -> (BV, BinaryPartition<T, BV>),
👎Deprecated: please use from_partitioning
instead
pub fn new_with_partitioning<F>( elements: Vec<(T, BV), Global>, partitioning: &mut F ) -> BVT<T, BV>where F: FnMut(usize, Vec<(T, BV), Global>) -> (BV, BinaryPartition<T, BV>),
from_partitioning
insteadBuilds a bounding volume tree using the specified partitioning function.
sourcepub fn from_partitioning(
elements: Vec<(T, BV), Global>,
partitioning: &mut impl FnMut(usize, Vec<(T, BV), Global>) -> (BV, BinaryPartition<T, BV>)
) -> BVT<T, BV>
pub fn from_partitioning( elements: Vec<(T, BV), Global>, partitioning: &mut impl FnMut(usize, Vec<(T, BV), Global>) -> (BV, BinaryPartition<T, BV>) ) -> BVT<T, BV>
Builds a bounding volume tree using the specified partitioning function.
sourcepub fn root_bounding_volume(&self) -> Option<&BV>
pub fn root_bounding_volume(&self) -> Option<&BV>
Reference to the bounding volume of the tree root.
sourcepub fn set_leaf_bounding_volume<N>(&mut self, i: usize, bv: BV, refit_now: bool)where
N: RealField + Copy,
BV: BoundingVolume<N>,
pub fn set_leaf_bounding_volume<N>(&mut self, i: usize, bv: BV, refit_now: bool)where N: RealField + Copy, BV: BoundingVolume<N>,
Set the bounding volume of the i-th leaf.
If refit_now
is true
, the bounding volumes of all the ancestors of the
modifiad leaf will be updated as well to enclose the new leaf bounding volume.
If refit_now
is false
, no ancestor update will be performed until the
.refit()
method is called. This is useful to refit the tree only once after
several leaf bounding volume modifications.
sourcepub fn refit<N>(&mut self, margin: N)where
N: RealField + Copy,
BV: BoundingVolume<N>,
pub fn refit<N>(&mut self, margin: N)where N: RealField + Copy, BV: BoundingVolume<N>,
Refits the bounding volumes so that all node of the BVT have boundin volumes that enclose their children.
This must be called to ensure the BVT is in a valid state after several calls to
.set_leaf_bounding_volume(_, _, false)
.
Every bounding volume created during this update will be enlarged by a margin of margin
.
The larger this margin here, the looser will the resulting AABB will be, but the less frequent
future updates will be necessary.
Setting a margin equal to 0.0 is allowed.
source§impl<T, BV> BVT<T, BV>
impl<T, BV> BVT<T, BV>
sourcepub fn new_balanced<N>(leaves: Vec<(T, BV), Global>) -> BVT<T, BV>where
N: RealField + Copy,
BV: BoundingVolume<N> + Clone,
pub fn new_balanced<N>(leaves: Vec<(T, BV), Global>) -> BVT<T, BV>where N: RealField + Copy, BV: BoundingVolume<N> + Clone,
Creates a balanced BVT
.
sourcepub fn median_partitioning_with_centers<N, F>(
depth: usize,
leaves: Vec<(T, BV), Global>,
center: &mut F
) -> (BV, BinaryPartition<T, BV>)where
F: FnMut(&T, &BV) -> OPoint<N, Const<2>>,
N: RealField + Copy,
BV: BoundingVolume<N> + Clone,
pub fn median_partitioning_with_centers<N, F>( depth: usize, leaves: Vec<(T, BV), Global>, center: &mut F ) -> (BV, BinaryPartition<T, BV>)where F: FnMut(&T, &BV) -> OPoint<N, Const<2>>, N: RealField + Copy, BV: BoundingVolume<N> + Clone,
Construction function for a kdree to be used with BVT::from_partitioning
.
sourcepub fn median_partitioning<N>(
depth: usize,
leaves: Vec<(T, BV), Global>
) -> (BV, BinaryPartition<T, BV>)where
N: RealField + Copy,
BV: BoundingVolume<N> + Clone,
pub fn median_partitioning<N>( depth: usize, leaves: Vec<(T, BV), Global> ) -> (BV, BinaryPartition<T, BV>)where N: RealField + Copy, BV: BoundingVolume<N> + Clone,
Construction function for a kdree to be used with BVT::from_partitioning
.
Trait Implementations§
source§impl<'a, T, BV> BVH<T, BV> for BVT<T, BV>
impl<'a, T, BV> BVH<T, BV> for BVT<T, BV>
source§fn num_children(&self, node: <BVT<T, BV> as BVH<T, BV>>::Node) -> usize
fn num_children(&self, node: <BVT<T, BV> as BVH<T, BV>>::Node) -> usize
source§fn child(
&self,
i: usize,
node: <BVT<T, BV> as BVH<T, BV>>::Node
) -> <BVT<T, BV> as BVH<T, BV>>::Node
fn child( &self, i: usize, node: <BVT<T, BV> as BVH<T, BV>>::Node ) -> <BVT<T, BV> as BVH<T, BV>>::Node
source§fn content(&self, node: <BVT<T, BV> as BVH<T, BV>>::Node) -> (&BV, Option<&T>)
fn content(&self, node: <BVT<T, BV> as BVH<T, BV>>::Node) -> (&BV, Option<&T>)
source§fn visit_bvtt(
&self,
other: &impl BVH<T, BV>,
visitor: &mut impl SimultaneousVisitor<T, BV>
)
fn visit_bvtt( &self, other: &impl BVH<T, BV>, visitor: &mut impl SimultaneousVisitor<T, BV> )
other
.source§fn best_first_search<N, BFS>(
&self,
visitor: &mut BFS
) -> Option<(Self::Node, <BFS as BestFirstVisitor<N, T, BV>>::Result)>where
N: RealField + Copy,
BFS: BestFirstVisitor<N, T, BV>,
fn best_first_search<N, BFS>( &self, visitor: &mut BFS ) -> Option<(Self::Node, <BFS as BestFirstVisitor<N, T, BV>>::Result)>where N: RealField + Copy, BFS: BestFirstVisitor<N, T, BV>,
source§impl<'de, T, BV> Deserialize<'de> for BVT<T, BV>where
T: Deserialize<'de>,
BV: Deserialize<'de>,
impl<'de, T, BV> Deserialize<'de> for BVT<T, BV>where T: Deserialize<'de>, BV: Deserialize<'de>,
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<BVT<T, BV>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<BVT<T, BV>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Auto Trait Implementations§
impl<T, BV> RefUnwindSafe for BVT<T, BV>where BV: RefUnwindSafe, T: RefUnwindSafe,
impl<T, BV> Send for BVT<T, BV>where BV: Send, T: Send,
impl<T, BV> Sync for BVT<T, BV>where BV: Sync, T: Sync,
impl<T, BV> Unpin for BVT<T, BV>where BV: Unpin, T: Unpin,
impl<T, BV> UnwindSafe for BVT<T, BV>where BV: UnwindSafe, T: 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
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
.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§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.§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.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.