Class BVHModelBase
Defined in File BVH_model.h
Inheritance Relationships
Base Type
public coal::CollisionGeometry
(Class CollisionGeometry)
Derived Types
public boost::serialization::internal::BVHModelBaseAccessor
(Struct BVHModelBaseAccessor)public coal::BVHModel< BV >
(Template Class BVHModel)
Class Documentation
-
class BVHModelBase : public coal::CollisionGeometry
A base class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as a degraded version of mesh)
Subclassed by boost::serialization::internal::BVHModelBaseAccessor, coal::BVHModel< BV >
Public Functions
-
inline BVHModelType getModelType() const
Model type described by the instance.
-
BVHModelBase()
Constructing an empty BVH.
-
BVHModelBase(const BVHModelBase &other)
copy from another BVH
-
inline virtual ~BVHModelBase()
deconstruction, delete mesh data related.
-
inline virtual OBJECT_TYPE getObjectType() const
Get the object type: it is a BVH.
-
int beginModel(unsigned int num_tris = 0, unsigned int num_vertices = 0)
Begin a new BVH model.
-
int addTriangle(const Vec3s &p1, const Vec3s &p2, const Vec3s &p3)
Add one triangle in the new BVH model.
-
int addSubModel(const std::vector<Vec3s> &ps, const std::vector<Triangle> &ts)
Add a set of triangles in the new BVH model.
-
int endModel()
End BVH model construction, will build the bounding volume hierarchy.
-
int beginReplaceModel()
Replace the geometry information of current frame (i.e. should have the same mesh topology with the previous frame)
-
int replaceTriangle(const Vec3s &p1, const Vec3s &p2, const Vec3s &p3)
Replace one triangle in the old BVH model.
-
int endReplaceModel(bool refit = true, bool bottomup = true)
End BVH model replacement, will also refit or rebuild the bounding volume hierarchy.
-
int beginUpdateModel()
Replace the geometry information of current frame (i.e. should have the same mesh topology with the previous frame). The current frame will be saved as the previous frame in prev_vertices.
-
int updateTriangle(const Vec3s &p1, const Vec3s &p2, const Vec3s &p3)
Update one triangle in the old BVH model.
-
int endUpdateModel(bool refit = true, bool bottomup = true)
End BVH model update, will also refit or rebuild the bounding volume hierarchy.
-
void buildConvexRepresentation(bool share_memory)
Build this Convex<Triangle> representation of this model. The result is stored in attribute convex.
Note
this only takes the points of this model. It does not check that the object is convex. It does not compute a convex hull.
-
bool buildConvexHull(bool keepTriangle, const char *qhullCommand = NULL)
Build a convex hull and store it in attribute convex.
See also
ConvexBase::convexHull
Warning
At the moment, the return value only checks whether there are as many points in the convex hull as in the original object. This is neither necessary (duplicated vertices get merged) nor sufficient (think of a U with 4 vertices and 3 edges).
- Parameters:
keepTriangle – whether the convex should be triangulated.
qhullCommand – see ConvexBase::convexHull.
- Returns:
true
if this object is convex, hence the convex hull represents the same object.
-
virtual int memUsage(const bool msg = false) const = 0
-
virtual void makeParentRelative() = 0
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.
-
inline virtual CoalScalar computeVolume() const
compute the volume
Public Members
-
std::shared_ptr<std::vector<Triangle>> tri_indices
Geometry triangle index data, will be NULL for point clouds.
-
unsigned int num_tris
Number of triangles.
-
unsigned int num_vertices
Number of points.
-
BVHBuildState build_state
The state of BVH building process.
-
shared_ptr<ConvexBase> convex
Convex<Triangle> representation of this object.
Protected Functions
-
virtual void deleteBVs() = 0
-
virtual bool allocateBVs() = 0
-
virtual int buildTree() = 0
Build the bounding volume hierarchy.
-
virtual int refitTree(bool bottomup) = 0
Refit the bounding volume hierarchy.
-
virtual bool isEqual(const CollisionGeometry &other) const
for ccd vertex update
Comparison operators
-
inline BVHModelType getModelType() const