ncollide3d::partitioning

Struct BVT

Source
pub struct BVT<T, BV> { /* private fields */ }
Expand description

A Bounding Volume Tree.

Implementations§

Source§

impl<T, BV> BVT<T, BV>

Source

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>

👎Deprecated: please use from_partitioning instead

Builds a bounding volume tree using the specified partitioning function.

Source

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.

Source

pub fn leaves(&self) -> &[BVTLeaf<T, BV>]

The set of leaves on this BVT.

Source

pub fn leaf(&self, i: usize) -> &BVTLeaf<T, BV>

Referenceto the i-th leaf of this BVT.

Source

pub fn root_bounding_volume(&self) -> Option<&BV>

Reference to the bounding volume of the tree root.

Source

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.

Source

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>

Source

pub fn new_balanced<N>(leaves: Vec<(T, BV)>) -> BVT<T, BV>
where N: RealField + Copy, BV: BoundingVolume<N> + Clone,

Creates a balanced BVT.

Source

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.

Source

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§

Source§

impl<'a, T, BV> BVH<T, BV> for BVT<T, BV>

Source§

type Node = BVTNodeId

Type of a node identifiers on this BVH.
Source§

fn root(&self) -> Option<Self::Node>

The root of the BVH.
Source§

fn num_children(&self, node: Self::Node) -> usize

The number of children of the given node.
Source§

fn child(&self, i: usize, node: Self::Node) -> Self::Node

The i-th child of the given node.
Source§

fn content(&self, node: Self::Node) -> (&BV, Option<&T>)

The bounding volume and data contained by the given node.
Source§

fn visit(&self, visitor: &mut impl Visitor<T, BV>)

Traverses this BVH using a visitor.
Source§

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.
Performs a best-first-search on the BVH. Read more
Source§

impl<T: Clone, BV: Clone> Clone for BVT<T, BV>

Source§

fn clone(&self) -> BVT<T, BV>

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

Auto Trait Implementations§

§

impl<T, BV> Freeze for BVT<T, BV>

§

impl<T, BV> RefUnwindSafe for BVT<T, BV>

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

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

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.