Implementation of an Bounding Volume Hierarchy Tree used for ray casting. More...
#include <BVH.hpp>
Classes | |
struct | AABB |
struct | BVHInner |
struct | BVHLeaf |
struct | BVHNode |
struct | Triangle |
Public Member Functions | |
BVHTree (const floatArr vertices, size_t n_vertices, const indexArray faces, size_t n_faces) | |
BVHTree (const MeshBufferPtr mesh) | |
BVHTree (const vector< float > &vertices, const vector< uint32_t > &faces) | |
Constructs the tree itself and it's cache friendly representation. More... | |
const vector< uint32_t > & | getIndexesOrTrilists () const |
const vector< float > & | getLimits () const |
const vector< float > & | getTrianglesIntersectionData () const |
Returns precalculated values for the triangle intersection tests. More... | |
const vector< uint32_t > & | getTriIndexList () const |
Private Types | |
using | BVHInnerPtr = unique_ptr< BVHInner > |
using | BVHLeafPtr = unique_ptr< BVHLeaf > |
using | BVHNodePtr = unique_ptr< BVHNode > |
Private Member Functions | |
BVHNodePtr | buildTree (const floatArr vertices, size_t n_vertices, const indexArray faces, size_t n_faces) |
Builds the tree without it's cache friendly representation. Utilizes the buildTreeRecursive method. More... | |
BVHNodePtr | buildTree (const vector< float > &vertices, const vector< uint32_t > &faces) |
Builds the tree without it's cache friendly representation. Utilizes the buildTreeRecursive method. More... | |
BVHNodePtr | buildTreeRecursive (vector< AABB > &work, uint32_t depth=0) |
Recursive method to build the tree. More... | |
void | convertTrianglesIntersectionData () |
Converts the precalculated triangle intersection data to a SIMD friendly structure. More... | |
void | createCFTree () |
Creates the cache friendly representation of the tree. Needs the tree itself! More... | |
void | createCFTreeRecursive (BVHNodePtr currentNode, uint32_t &idxBoxes) |
Recursive method for cache friendly tree creation. More... | |
Private Attributes | |
vector< uint32_t > | m_indexesOrTrilists |
vector< float > | m_limits |
BVHNodePtr | m_root |
vector< Triangle > | m_triangles |
vector< float > | m_trianglesIntersectionData |
vector< uint32_t > | m_triIndexList |
Implementation of an Bounding Volume Hierarchy Tree used for ray casting.
This class generates a BVHTree from the given triangle mesh represented by vertices and faces. AABB are used as bounding volumes. The Tree Contains inner nodes and leaf nodes. The leaf nodes are grouped into inner nodes using the surface area heuristic. The tree is represented in two ways: the normal tree structure and the cache friendly index representation.
BaseVecT |
|
private |
|
private |
|
private |
lvr2::BVHTree< BaseVecT >::BVHTree | ( | const vector< float > & | vertices, |
const vector< uint32_t > & | faces | ||
) |
Constructs the tree itself and it's cache friendly representation.
vertices | Vertices of mesh to create tree for |
faces | Faces of mesh to create tree for |
lvr2::BVHTree< BaseVecT >::BVHTree | ( | const floatArr | vertices, |
size_t | n_vertices, | ||
const indexArray | faces, | ||
size_t | n_faces | ||
) |
lvr2::BVHTree< BaseVecT >::BVHTree | ( | const MeshBufferPtr | mesh | ) |
|
private |
Builds the tree without it's cache friendly representation. Utilizes the buildTreeRecursive method.
vertices | Vertices of mesh to create tree for |
faces | Faces of mesh to create tree for |
|
private |
Builds the tree without it's cache friendly representation. Utilizes the buildTreeRecursive method.
vertices | Vertices of mesh to create tree for |
faces | Faces of mesh to create tree for |
|
private |
Recursive method to build the tree.
work | The current work queue to generate the tree from |
depth | The current depth of the tree |
|
private |
Converts the precalculated triangle intersection data to a SIMD friendly structure.
|
private |
Creates the cache friendly representation of the tree. Needs the tree itself!
|
private |
Recursive method for cache friendly tree creation.
currentNode | Current node to convert to it's cache friendly form |
idxBoxes | Number of boxes created for the current tree. This has to be increased every time a box is processed. |
const vector<uint32_t>& lvr2::BVHTree< BaseVecT >::getIndexesOrTrilists | ( | ) | const |
const vector<float>& lvr2::BVHTree< BaseVecT >::getLimits | ( | ) | const |
const vector<float>& lvr2::BVHTree< BaseVecT >::getTrianglesIntersectionData | ( | ) | const |
Returns precalculated values for the triangle intersection tests.
const vector<uint32_t>& lvr2::BVHTree< BaseVecT >::getTriIndexList | ( | ) | const |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |