Struct ncollide2d::partitioning::BVT
source · [−]pub struct BVT<T, BV> { /* private fields */ }
Expand description
A Bounding Volume Tree.
Implementations
sourceimpl<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>
please use from_partitioning
instead
Builds 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.
sourceimpl<T, BV> BVT<T, BV>
impl<T, BV> BVT<T, BV>
sourcepub fn new_balanced<N>(leaves: Vec<(T, BV)>) -> BVT<T, BV> where
N: RealField + Copy,
BV: BoundingVolume<N> + Clone,
pub fn new_balanced<N>(leaves: Vec<(T, BV)>) -> BVT<T, BV> where
N: RealField + Copy,
BV: BoundingVolume<N> + Clone,
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>) where
N: RealField + Copy,
BV: BoundingVolume<N> + Clone,
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>) where
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)>
) -> (BV, BinaryPartition<T, BV>) where
N: RealField + Copy,
BV: BoundingVolume<N> + Clone,
pub fn median_partitioning<N>(
depth: usize,
leaves: Vec<(T, BV)>
) -> (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
sourceimpl<'a, T, BV> BVH<T, BV> for BVT<T, BV>
impl<'a, T, BV> BVH<T, BV> for BVT<T, BV>
sourcefn num_children(&self, node: Self::Node) -> usize
fn num_children(&self, node: Self::Node) -> usize
The number of children of the given node.
sourcefn content(&self, node: Self::Node) -> (&BV, Option<&T>)
fn content(&self, node: Self::Node) -> (&BV, Option<&T>)
The bounding volume and data contained by the given node.
sourcefn 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>
)
Visits the bounding volume test tree implicitly formed with other
.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert 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
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
sourceimpl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> DowncastSync for T where
T: Any + Send + Sync,
sourceimpl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
sourcefn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
OverflowingCasts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
sourcefn 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 more
sourcefn 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).
sourcefn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
sourcefn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
UnwrappedCasts the value.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
WrappingCasts the value.