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: FnMut(usize, Vec<(T, BV)>) -> (BV, BinaryPartition<T, BV>)>(
elements: Vec<(T, BV)>,
partitioning: &mut F,
) -> BVT<T, BV>
👎Deprecated: please use from_partitioning
instead
pub fn new_with_partitioning<F: FnMut(usize, Vec<(T, BV)>) -> (BV, BinaryPartition<T, BV>)>( elements: Vec<(T, BV)>, partitioning: &mut F, ) -> BVT<T, BV>
from_partitioning
insteadBuilds a bounding volume tree using the specified partitioning function.
Sourcepub fn from_partitioning(
elements: Vec<(T, BV)>,
partitioning: &mut impl FnMut(usize, Vec<(T, BV)>) -> (BV, BinaryPartition<T, BV>),
) -> BVT<T, BV>
pub fn from_partitioning( elements: Vec<(T, BV)>, partitioning: &mut impl FnMut(usize, Vec<(T, BV)>) -> (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: RealField + Copy>(
&mut self,
i: usize,
bv: BV,
refit_now: bool,
)where
BV: BoundingVolume<N>,
pub fn set_leaf_bounding_volume<N: RealField + Copy>(
&mut self,
i: usize,
bv: BV,
refit_now: bool,
)where
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: RealField + Copy>(&mut self, margin: N)where
BV: BoundingVolume<N>,
pub fn refit<N: RealField + Copy>(&mut self, margin: N)where
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)>) -> BVT<T, BV>
pub fn new_balanced<N>(leaves: Vec<(T, BV)>) -> BVT<T, BV>
Creates a balanced BVT
.
Sourcepub fn median_partitioning_with_centers<N, F: FnMut(&T, &BV) -> Point<N>>(
depth: usize,
leaves: Vec<(T, BV)>,
center: &mut F,
) -> (BV, BinaryPartition<T, BV>)
pub fn median_partitioning_with_centers<N, F: FnMut(&T, &BV) -> Point<N>>( depth: usize, leaves: Vec<(T, BV)>, center: &mut F, ) -> (BV, BinaryPartition<T, BV>)
Construction function for a kdree to be used with BVT::from_partitioning
.
Sourcepub fn median_partitioning<N>(
depth: usize,
leaves: Vec<(T, BV)>,
) -> (BV, BinaryPartition<T, BV>)
pub fn median_partitioning<N>( depth: usize, leaves: Vec<(T, BV)>, ) -> (BV, BinaryPartition<T, BV>)
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: Self::Node) -> usize
fn num_children(&self, node: Self::Node) -> usize
Source§fn content(&self, node: Self::Node) -> (&BV, Option<&T>)
fn content(&self, node: Self::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
.Auto Trait Implementations§
impl<T, BV> Freeze for BVT<T, BV>
impl<T, BV> RefUnwindSafe for BVT<T, BV>where
BV: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, BV> Send for BVT<T, BV>
impl<T, BV> Sync for BVT<T, BV>
impl<T, BV> Unpin for BVT<T, BV>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<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.