[][src]Struct mgf::BVH

pub struct BVH<B: Bound, V> { /* fields omitted */ }

A Bounding Volume Hierarchy.

Methods

impl<B: Bound, V> BVH<B, V>[src]

pub fn new() -> Self[src]

Creates an empty BVH.

pub fn with_capacity(cap: usize) -> Self[src]

Creates a BVH with a preallocated array of cap.

pub fn empty(&self) -> bool[src]

Determines if the BVH is empty.

pub fn clear(&mut self)[src]

Removes all entries from the BVH.

pub fn insert<K: BoundedBy<B>>(&mut self, key: &K, val: V) -> usize[src]

Inserts an item into the BVH, rebalancing if necessary. All IDs returned prior to insert remain valid afterward.

pub fn remove(&mut self, leaf: usize)[src]

Removes a leaf node from the BVH.

pub fn root(&self) -> usize[src]

Returns the index of the root node.

pub fn get_leaf(&self, i: usize) -> &V[src]

pub fn query<Arg, F>(&self, arg: &Arg, callback: F) where
    Arg: BoundedBy<B>,
    F: FnMut(&V), 
[src]

Finds each entry in the BVH that has a bound that overlaps the bound of the passed object. Performs a depth first search for all objects.

callback is called for each entry that overlaps arg. A reference to the value stored at the leaf is passed.

pub fn query_mut<Arg, F>(&mut self, arg: &Arg, callback: F) where
    Arg: BoundedBy<B>,
    F: FnMut(&mut V), 
[src]

Finds each entry in the BVH that has a bound that overlaps the bound of the passed object. Performs a depth first search for all objects.

callback is called for each entry that overlaps arg. A mutable reference to the value stored at the leaf is passed.

pub fn raytrace<Arg, F>(&self, arg: &Arg, callback: F) where
    Arg: Intersects<B>,
    F: FnMut(&V, Intersection), 
[src]

Finds all entries that intersect a ray or segment.

Trait Implementations

impl<B, V> BoundedBy<B> for BVH<B, V> where
    B: Bound
[src]

impl<B, V> Clone for BVH<B, V> where
    B: Bound,
    V: Clone
[src]

impl<'de, B: Bound, V> Deserialize<'de> for BVH<B, V> where
    B: Deserialize<'de>,
    V: Deserialize<'de>, 
[src]

impl<B, V> Index<usize> for BVH<B, V> where
    B: Bound
[src]

type Output = B

The returned type after indexing.

impl<B: Bound, V> Serialize for BVH<B, V> where
    B: Serialize,
    V: Serialize
[src]

Auto Trait Implementations

impl<B, V> RefUnwindSafe for BVH<B, V> where
    B: RefUnwindSafe,
    V: RefUnwindSafe

impl<B, V> Send for BVH<B, V> where
    B: Send,
    V: Send

impl<B, V> Sync for BVH<B, V> where
    B: Sync,
    V: Sync

impl<B, V> Unpin for BVH<B, V> where
    B: Unpin,
    V: Unpin

impl<B, V> UnwindSafe for BVH<B, V> where
    B: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.