Commit 3f12bc6e authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

Add BVHModelBase::buildConvexHull

parent 2404e18e
......@@ -82,7 +82,7 @@ public:
/// @brief Convex<Triangle> representation of this object
boost::shared_ptr< ConvexBase > convex;
/// @brief Model type described by the instance
BVHModelType getModelType() const
......@@ -173,11 +173,25 @@ public:
/// @brief End BVH model update, will also refit or rebuild the bounding volume hierarchy
int endUpdateModel(bool refit = true, bool bottomup = true);
/// @brief Build this Convex<Triangle> representation of this model.
/// @brief Build this \ref Convex "Convex<Triangle>" representation of this model.
/// The result is stored in attribute \ref 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.
void buildConvexRepresentation(bool share_memory);
/// @brief Build a convex hull
/// and store it in attribute \ref convex.
/// \param keepTriangle whether the convex should be triangulated.
/// \param qhullCommand see \ref ConvexBase::convexHull.
/// \return \c true if this object is convex, hence the convex hull represents
/// the same object.
/// \sa 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).
bool buildConvexHull(bool keepTriangle, const char* qhullCommand = NULL);
virtual int memUsage(int msg) const = 0;
/// @brief 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
......@@ -50,6 +50,7 @@
#include <hpp/fcl/internal/BV_splitter.h>
#include "doxygen_autodoc/hpp/fcl/BVH/BVH_model.h"
#include "doxygen_autodoc/hpp/fcl/shape/geometric_shapes.h"
#include "doxygen_autodoc/functions.h"
#include "../doc/python/doxygen.hh"
......@@ -396,7 +397,8 @@ void exposeCollisionGeometries ()
.def_readonly ("convex", &BVHModelBase::convex)
.def ("buildConvexRepresentation", &BVHModelBase::buildConvexRepresentation)
.DEF_CLASS_FUNC(BVHModelBase, buildConvexRepresentation)
.DEF_CLASS_FUNC(BVHModelBase, buildConvexHull)
// Expose function to build a BVH
.def(dv::member_func("beginModel", &BVHModelBase::beginModel))
......@@ -100,6 +100,14 @@ void BVHModelBase::buildConvexRepresentation(bool share_memory)
bool BVHModelBase::buildConvexHull(bool keepTriangle, const char* qhullCommand)
ConvexBase::convexHull(vertices, num_vertices, keepTriangle, qhullCommand)
return num_vertices == convex->num_points;
template<typename BV>
BVHModel<BV>::BVHModel(const BVHModel<BV>& other) : BVHModelBase(other),
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment