Template Class BVHModel

Inheritance Relationships

Base Type

Derived Type

Class Documentation

template<typename BV>
class BVHModel : public coal::BVHModelBase

A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as a degraded version of mesh)

Template Parameters:

BV – one of the bounding volume class in Bounding volumes.

Subclassed by boost::serialization::internal::BVHModelAccessor< BV >

Public Types

using bv_node_vector_t = std::vector<BVNode<BV>, Eigen::aligned_allocator<BVNode<BV>>>

Public Functions

BVHModel()

Default constructor to build an empty BVH.

BVHModel(const BVHModel &other)

Copy constructor from another BVH.

Parameters:

other[in] BVHModel to copy.

inline virtual BVHModel<BV> *clone() const

Clone *this into a new BVHModel.

inline ~BVHModel()

deconstruction, delete mesh data related.

inline const BVNode<BV> &getBV(unsigned int i) const

We provide getBV() and getNumBVs() because BVH may be compressed (in future), so we must provide some flexibility here.

Access the bv giving the its index

inline BVNode<BV> &getBV(unsigned int i)

Access the bv giving the its index.

inline unsigned int getNumBVs() const

Get the number of bv in the BVH.

inline virtual NODE_TYPE getNodeType() const

Get the BV type: default is unknown.

virtual int memUsage(const bool msg) const

Check the number of memory used.

inline virtual void makeParentRelative()

This is a special acceleration: BVH_model default stores the BV’s transform in world coordinate. However, we can also store each BV’s transform related to its parent BV node. When traversing the BVH, this can save one matrix transformation.

virtual NODE_TYPE getNodeType() const

Specialization of getNodeType() for BVHModel with different BV types.

virtual NODE_TYPE getNodeType() const

get the node type

virtual NODE_TYPE getNodeType() const

get the node type

virtual NODE_TYPE getNodeType() const

get the node type

virtual NODE_TYPE getNodeType() const

get the node type

virtual NODE_TYPE getNodeType() const

get the node type

virtual NODE_TYPE getNodeType() const

get the node type

virtual NODE_TYPE getNodeType() const

get the node type

Public Members

shared_ptr<BVSplitter<BV>> bv_splitter

Split rule to split one BV node into two children.

shared_ptr<BVFitter<BV>> bv_fitter

Fitting rule to fit a BV node to a set of geometry primitives.

Protected Functions

virtual void deleteBVs()
virtual bool allocateBVs()
virtual int buildTree()

Build the bounding volume hierarchy.

virtual int refitTree(bool bottomup)

Refit the bounding volume hierarchy.

int refitTree_topdown()

Refit the bounding volume hierarchy in a top-down way (slow but more compact)

int refitTree_bottomup()

Refit the bounding volume hierarchy in a bottom-up way (fast but less compact)

int recursiveBuildTree(int bv_id, unsigned int first_primitive, unsigned int num_primitives)

Recursive kernel for hierarchy construction.

int recursiveRefitTree_bottomup(int bv_id)

Recursive kernel for bottomup refitting.

inline void makeParentRelativeRecurse(int bv_id, Matrix3s &parent_axes, const Vec3s &parent_c)

@ recursively compute each bv’s transform related to its parent. For default BV, only the translation works. For oriented BV (OBB, RSS, OBBRSS), special implementation is provided.

void makeParentRelativeRecurse(int bv_id, Matrix3s &parent_axes, const Vec3s &parent_c)
void makeParentRelativeRecurse(int bv_id, Matrix3s &parent_axes, const Vec3s &parent_c)
void makeParentRelativeRecurse(int bv_id, Matrix3s &parent_axes, const Vec3s &parent_c)

Protected Attributes

unsigned int num_bvs_allocated
std::shared_ptr<std::vector<unsigned int>> primitive_indices
std::shared_ptr<bv_node_vector_t> bvs

Bounding volume hierarchy.

unsigned int num_bvs

Number of BV nodes in bounding volume hierarchy.