Struct bvh::bvh::BVH [−][src]
Fields
nodes: Vec<BVHNode>
The list of nodes of the BVH
.
Implementations
impl BVH
[src]
impl BVH
[src]pub fn build<Shape: BHShape>(shapes: &mut [Shape]) -> BVH
[src]
Creates a new BVH
from the shapes
slice.
pub fn traverse<'a, Shape: Bounded>(
&'a self,
ray: &Ray,
shapes: &'a [Shape]
) -> Vec<&Shape>
[src]
&'a self,
ray: &Ray,
shapes: &'a [Shape]
) -> Vec<&Shape>
pub fn traverse_iterator<'a, Shape: Bounded>(
&'a self,
ray: &'a Ray,
shapes: &'a [Shape]
) -> BVHTraverseIterator<'_, Shape>ⓘNotable traits for BVHTraverseIterator<'a, Shape>
impl<'a, Shape: Bounded> Iterator for BVHTraverseIterator<'a, Shape> type Item = &'a Shape;
[src]
&'a self,
ray: &'a Ray,
shapes: &'a [Shape]
) -> BVHTraverseIterator<'_, Shape>ⓘ
Notable traits for BVHTraverseIterator<'a, Shape>
impl<'a, Shape: Bounded> Iterator for BVHTraverseIterator<'a, Shape> type Item = &'a Shape;
Creates a BVHTraverseIterator
to traverse the BVH
.
Returns a subset of shapes
, in which the AABB
s of the elements were hit by ray
.
pub fn pretty_print(&self)
[src]
Prints the BVH
in a tree-like visualization.
pub fn is_consistent<Shape: BHShape>(&self, shapes: &[Shape]) -> bool
[src]
Checks if all children of a node have the correct parent index, and that there is no
detached subtree. Also checks if the AABB
hierarchy is consistent.
pub fn assert_consistent<Shape: BHShape>(&self, shapes: &[Shape])
[src]
Assert version of is_consistent
.
pub fn assert_tight_subtree<Shape: BHShape>(
&self,
node_index: usize,
outer_aabb: &AABB,
shapes: &[Shape]
)
[src]
&self,
node_index: usize,
outer_aabb: &AABB,
shapes: &[Shape]
)
Check that the AABB
s in the BVH
are tight, which means, that parent AABB
s are not
larger than they should be. This function checks, whether the children of node node_index
lie inside outer_aabb
.
pub fn assert_tight<Shape: BHShape>(&self, shapes: &[Shape])
[src]
Check that the AABB
s in the BVH
are tight, which means, that parent AABB
s are not
larger than they should be.
impl BVH
[src]
impl BVH
[src]pub fn optimize<Shape: BHShape>(
&mut self,
refit_shape_indices: &HashSet<usize>,
shapes: &[Shape]
)
[src]
&mut self,
refit_shape_indices: &HashSet<usize>,
shapes: &[Shape]
)
Optimizes the BVH
by batch-reorganizing updated nodes.
Based on https://github.com/jeske/SimpleScene/blob/master/SimpleScene/Util/ssBVH/ssBVH.cs
Needs all the scene’s shapes, plus the indices of the shapes that were updated.
impl BVH
[src]
impl BVH
[src]pub fn flatten_custom<F, FNodeType>(&self, constructor: &F) -> Vec<FNodeType> where
F: Fn(&AABB, u32, u32, u32) -> FNodeType,
[src]
F: Fn(&AABB, u32, u32, u32) -> FNodeType,
Flattens the BVH
so that it can be traversed iteratively.
Constructs the flat nodes using the supplied function.
This function can be used, when the flat bvh nodes should be of some particular
non-default structure.
The constructor
is fed the following arguments in this order:
1 - &AABB: The enclosing AABB
2 - u32: The index of the nested node
3 - u32: The exit index
4 - u32: The shape index
Example
use bvh::aabb::{AABB, Bounded}; use bvh::bvh::BVH; use bvh::nalgebra::{Point3, Vector3}; use bvh::ray::Ray; struct CustomStruct { aabb: AABB, entry_index: u32, exit_index: u32, shape_index: u32, } let custom_constructor = |aabb: &AABB, entry, exit, shape_index| { CustomStruct { aabb: *aabb, entry_index: entry, exit_index: exit, shape_index: shape_index, } }; let mut shapes = create_bhshapes(); let bvh = BVH::build(&mut shapes); let custom_flat_bvh = bvh.flatten_custom(&custom_constructor);
pub fn flatten(&self) -> FlatBVH
[src]
Trait Implementations
impl BoundingHierarchy for BVH
[src]
impl BoundingHierarchy for BVH
[src]fn build<Shape: BHShape>(shapes: &mut [Shape]) -> BVH
[src]
fn traverse<'a, Shape: Bounded>(
&'a self,
ray: &Ray,
shapes: &'a [Shape]
) -> Vec<&Shape>
[src]
&'a self,
ray: &Ray,
shapes: &'a [Shape]
) -> Vec<&Shape>
fn pretty_print(&self)
[src]
Auto Trait Implementations
impl RefUnwindSafe for BVH
impl RefUnwindSafe for BVH
impl UnwindSafe for BVH
impl UnwindSafe for BVH
Blanket Implementations
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,