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>( 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

Builds a bounding volume tree using the specified partitioning function.

source

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.

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>(&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.

source

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>

source

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.

source

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.

source

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>

§

type Node = BVTNodeId

Type of a node identifiers on this BVH.
source§

fn root(&self) -> Option<<BVT<T, BV> as BVH<T, BV>>::Node>

The root of the BVH.
source§

fn num_children(&self, node: <BVT<T, BV> as BVH<T, BV>>::Node) -> usize

The number of children of the given node.
source§

fn child( &self, i: usize, node: <BVT<T, BV> as BVH<T, BV>>::Node ) -> <BVT<T, BV> as BVH<T, BV>>::Node

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

fn content(&self, node: <BVT<T, BV> as BVH<T, BV>>::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, BV> Clone for BVT<T, BV>where T: Clone, BV: Clone,

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
source§

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>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T, BV> Serialize for BVT<T, BV>where T: Serialize, BV: Serialize,

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, 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.
§

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

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

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

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

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

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

impl<T> Finalize for T

§

unsafe fn finalize_raw(data: *mut ())

Safety Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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<T> for T

§

type Output = T

Should always be Self
§

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

§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

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

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

impl<T> UserData for Twhere T: Clone + Any + Send + Sync,

source§

fn clone_boxed(&self) -> Box<dyn UserData, Global>

Clone this trait-object.
source§

fn to_any(&self) -> Box<dyn Any + Send + Sync, Global>

Clone as its super-trait trait objects.
source§

fn as_any(&self) -> &(dyn Any + Send + Sync + 'static)

Downcast to Any.
§

impl<T> Component for Twhere T: Send + Sync + 'static,

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,