pub enum BvhNode<T: BHValue, const D: usize> {
Leaf {
parent_index: usize,
shape_index: usize,
},
Node {
parent_index: usize,
child_l_index: usize,
child_l_aabb: Aabb<T, D>,
child_r_index: usize,
child_r_aabb: Aabb<T, D>,
},
}
Expand description
Variants§
Implementations§
source§impl<T: BHValue, const D: usize> BvhNode<T, D>
impl<T: BHValue, const D: usize> BvhNode<T, D>
sourcepub fn build<S: BHShape<T, D>>(args: BvhNodeBuildArgs<'_, S, T, D>)
pub fn build<S: BHShape<T, D>>(args: BvhNodeBuildArgs<'_, S, T, D>)
Builds a BvhNode
recursively using SAH partitioning.
sourcepub fn build_with_executor<S: BHShape<T, D>>(
args: BvhNodeBuildArgs<'_, S, T, D>,
executor: impl FnMut(BvhNodeBuildArgs<'_, S, T, D>, BvhNodeBuildArgs<'_, S, T, D>)
)
pub fn build_with_executor<S: BHShape<T, D>>( args: BvhNodeBuildArgs<'_, S, T, D>, executor: impl FnMut(BvhNodeBuildArgs<'_, S, T, D>, BvhNodeBuildArgs<'_, S, T, D>) )
Builds a BvhNode
with a custom executor function using SAH partitioning.
source§impl<T: BHValue, const D: usize> BvhNode<T, D>
impl<T: BHValue, const D: usize> BvhNode<T, D>
sourcepub fn parent_mut(&mut self) -> &mut usize
pub fn parent_mut(&mut self) -> &mut usize
Returns a mutable reference to the parent node index.
sourcepub fn child_l_mut(&mut self) -> &mut usize
pub fn child_l_mut(&mut self) -> &mut usize
Returns the index of the left child node.
sourcepub fn child_l_aabb(&self) -> Aabb<T, D>
pub fn child_l_aabb(&self) -> Aabb<T, D>
Returns the Aabb
of the right child node.
sourcepub fn child_l_aabb_mut(&mut self) -> &mut Aabb<T, D>
pub fn child_l_aabb_mut(&mut self) -> &mut Aabb<T, D>
Returns a mutable reference to the Aabb
of the left child node.
sourcepub fn child_r_mut(&mut self) -> &mut usize
pub fn child_r_mut(&mut self) -> &mut usize
Returns the index of the right child node.
sourcepub fn child_r_aabb(&self) -> Aabb<T, D>
pub fn child_r_aabb(&self) -> Aabb<T, D>
Returns the Aabb
of the right child node.
sourcepub fn child_r_aabb_mut(&mut self) -> &mut Aabb<T, D>
pub fn child_r_aabb_mut(&mut self) -> &mut Aabb<T, D>
Returns a mutable reference to the Aabb
of the right child node.
sourcepub fn get_node_aabb<Shape: BHShape<T, D>>(
&self,
shapes: &[Shape]
) -> Aabb<T, D>
pub fn get_node_aabb<Shape: BHShape<T, D>>( &self, shapes: &[Shape] ) -> Aabb<T, D>
sourcepub fn shape_index(&self) -> Option<usize>
pub fn shape_index(&self) -> Option<usize>
Returns the index of the shape contained within the node if is a leaf,
or None
if it is an interior node.
sourcepub fn shape_index_mut(&mut self) -> Option<&mut usize>
pub fn shape_index_mut(&mut self) -> Option<&mut usize>
Returns the index of the shape contained within the node if is a leaf,
or None
if it is an interior node.
source§impl<T: BHValue + Float, const D: usize> BvhNode<T, D>
impl<T: BHValue + Float, const D: usize> BvhNode<T, D>
Trait Implementations§
source§impl<T: BHValue, const D: usize> PartialEq for BvhNode<T, D>
impl<T: BHValue, const D: usize> PartialEq for BvhNode<T, D>
impl<T: Copy + BHValue, const D: usize> Copy for BvhNode<T, D>
Auto Trait Implementations§
impl<T, const D: usize> Freeze for BvhNode<T, D>where
T: Freeze,
impl<T, const D: usize> RefUnwindSafe for BvhNode<T, D>where
T: RefUnwindSafe,
impl<T, const D: usize> Send for BvhNode<T, D>where
T: Send,
impl<T, const D: usize> Sync for BvhNode<T, D>where
T: Sync,
impl<T, const D: usize> Unpin for BvhNode<T, D>where
T: Unpin,
impl<T, const D: usize> UnwindSafe for BvhNode<T, D>where
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
Mutably borrows from an owned value. Read more
source§impl<T> Pointable for T
impl<T> Pointable 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>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn 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).source§fn 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.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.