Commit 3ee66493 authored by jpan's avatar jpan
Browse files

more documentation and file reorganize


git-svn-id: https://kforge.ros.org/fcl/fcl_ros@151 253336fb-580f-4252-a368-f3cef5a2a82b
parent 68d90644
......@@ -41,7 +41,7 @@ link_directories(${OCTOMAP_LIBRARY_DIRS})
add_definitions(-DUSE_SVMLIGHT=0)
add_library(${PROJECT_NAME} SHARED src/BV/AABB.cpp src/BV/OBB.cpp src/BV/RSS.cpp src/BV/kIOS.cpp src/BV/OBBRSS.cpp src/BV/kDOP.cpp src/traversal_node_base.cpp src/traversal_node_bvhs.cpp src/intersect.cpp src/motion.cpp src/BV_fitter.cpp src/BV_splitter.cpp src/BVH_model.cpp src/BVH_utility.cpp src/transform.cpp src/simple_setup.cpp src/geometric_shapes.cpp src/geometric_shapes_utility.cpp src/collision_node.cpp src/traversal_recurse.cpp src/broad_phase_collision.cpp src/collision.cpp src/collision_func_matrix.cpp src/interval_tree.cpp src/conservative_advancement.cpp src/ccd/interval.cpp src/ccd/interval_vector.cpp src/ccd/interval_matrix.cpp src/ccd/taylor_model.cpp src/ccd/taylor_vector.cpp src/ccd/taylor_matrix.cpp src/distance_func_matrix.cpp src/distance.cpp src/narrowphase/gjk.cpp src/narrowphase/gjk_libccd.cpp src/narrowphase/narrowphase.cpp src/hierarchy_tree.cpp)
add_library(${PROJECT_NAME} SHARED src/BV/AABB.cpp src/BV/OBB.cpp src/BV/RSS.cpp src/BV/kIOS.cpp src/BV/OBBRSS.cpp src/BV/kDOP.cpp src/traversal_node_base.cpp src/traversal_node_bvhs.cpp src/intersect.cpp src/motion.cpp src/BV_fitter.cpp src/BV_splitter.cpp src/BVH_model.cpp src/BVH_utility.cpp src/transform.cpp src/simple_setup.cpp src/geometric_shapes.cpp src/geometric_shapes_utility.cpp src/collision_node.cpp src/traversal_recurse.cpp src/broadphase/broadphase_bruteforce.cpp src/broadphase/broadphase_spatialhash.cpp src/broadphase/broadphase_SaP.cpp src/broadphase/broadphase_SSaP.cpp src/broadphase/broadphase_interval_tree.cpp src/broadphase/broadphase_dynamic_AABB_tree.cpp src/broadphase/broadphase_dynamic_AABB_tree_array.cpp src/collision.cpp src/collision_func_matrix.cpp src/broadphase/interval_tree.cpp src/conservative_advancement.cpp src/ccd/interval.cpp src/ccd/interval_vector.cpp src/ccd/interval_matrix.cpp src/ccd/taylor_model.cpp src/ccd/taylor_vector.cpp src/ccd/taylor_matrix.cpp src/distance_func_matrix.cpp src/distance.cpp src/narrowphase/gjk.cpp src/narrowphase/gjk_libccd.cpp src/narrowphase/narrowphase.cpp src/broadphase/hierarchy_tree.cpp)
target_link_libraries(${PROJECT_NAME} ${FLANN_LIBRARIES} ${CCD_LIBRARIES} ${OCTOMAP_LIBRARIES})
......
......@@ -125,6 +125,10 @@ public:
FCL_REAL distance(const OBB& other, Vec3f* P = NULL, Vec3f* Q = NULL) const;
};
/// @brief Translate the OBB bv
OBB translate(const OBB& bv, const Vec3f& t);
/// @brief Check collision between two obbs, b1 is in configuration (R0, T0) and b2 is in identity.
bool overlap(const Matrix3f& R0, const Vec3f& T0, const OBB& b1, const OBB& b2);
......
......@@ -143,6 +143,8 @@ public:
}
};
/// @brief Translate the OBBRSS bv
OBBRSS translate(const OBBRSS& bv, const Vec3f& t);
/// @brief Check collision between two OBBRSS, b1 is in configuration (R0, T0) and b2 is in indentity
bool overlap(const Matrix3f& R0, const Vec3f& T0, const OBBRSS& b1, const OBBRSS& b2);
......
......@@ -130,6 +130,10 @@ public:
};
/// @brief Translate the RSS bv
RSS translate(const RSS& bv, const Vec3f& t);
/// @brief distance between two RSS bounding volumes
/// P and Q (optional return values) are the closest points in the rectangles, not the RSS. But the direction P - Q is the correct direction for cloest points
/// Notice that P and Q are both in the local frame of the first RSS (not global frame and not even the local frame of object 1)
......
......@@ -128,9 +128,25 @@ private:
/// @brief Origin's distances to N KDOP planes
FCL_REAL dist_[N];
public:
inline FCL_REAL dist(std::size_t i) const
{
return dist_[i];
}
inline FCL_REAL& dist(std::size_t i)
{
return dist_[i];
}
};
/// @brief translate the KDOP BV
template<size_t N>
KDOP<N> translate(const KDOP<N>& bv, const Vec3f& t);
}
#endif
......@@ -147,6 +147,10 @@ private:
};
/// @brief Translate the kIOS BV
kIOS translate(const kIOS& bv, const Vec3f& t);
/// @brief Check collision between two kIOSs, b1 is in configuration (R0, T0) and b2 is in identity.
/// @todo Not efficient
bool overlap(const Matrix3f& R0, const Vec3f& T0, const kIOS& b1, const kIOS& b2);
......
......@@ -42,46 +42,41 @@
namespace fcl
{
/** \brief States for BVH construction
* empty->begun->processed ->replace_begun->processed -> ......
* |
* |-> update_begun -> updated -> .....
* */
/// @brief States for BVH construction
/// empty->begun->processed ->replace_begun->processed -> ......
/// |
/// |-> update_begun -> updated -> .....
enum BVHBuildState
{
BVH_BUILD_STATE_EMPTY, // empty state, immediately after constructor
BVH_BUILD_STATE_BEGUN, // after beginModel(), state for adding geometry primitives
BVH_BUILD_STATE_PROCESSED, // after tree has been build, ready for cd use
BVH_BUILD_STATE_UPDATE_BEGUN, // after beginUpdateModel(), state for updating geometry primitives
BVH_BUILD_STATE_UPDATED, // after tree has been build for updated geometry, ready for ccd use
BVH_BUILD_STATE_REPLACE_BEGUN, // after beginReplaceModel(), state for replacing geometry primitives
};
{
BVH_BUILD_STATE_EMPTY, /// empty state, immediately after constructor
BVH_BUILD_STATE_BEGUN, /// after beginModel(), state for adding geometry primitives
BVH_BUILD_STATE_PROCESSED, /// after tree has been build, ready for cd use
BVH_BUILD_STATE_UPDATE_BEGUN, /// after beginUpdateModel(), state for updating geometry primitives
BVH_BUILD_STATE_UPDATED, /// after tree has been build for updated geometry, ready for ccd use
BVH_BUILD_STATE_REPLACE_BEGUN, /// after beginReplaceModel(), state for replacing geometry primitives
};
/** \brief Error code for BVH */
/// @brief Error code for BVH
enum BVHReturnCode
{
BVH_OK = 0,
BVH_ERR_MODEL_OUT_OF_MEMORY = -1,
BVH_ERR_OUT_OF_MEMORY = -2,
BVH_ERR_UNPROCESSED_MODEL = -3,
BVH_ERR_BUILD_OUT_OF_SEQUENCE = -4,
BVH_ERR_BUILD_EMPTY_MODEL = -5,
BVH_ERR_BUILD_EMPTY_PREVIOUS_FRAME = -6,
BVH_ERR_UNSUPPORTED_FUNCTION = -7,
BVH_ERR_UNUPDATED_MODEL = -8,
BVH_ERR_INCORRECT_DATA = -9,
BVH_ERR_UNKNOWN = -10
};
{
BVH_OK = 0, /// BVH is valid
BVH_ERR_MODEL_OUT_OF_MEMORY = -1, /// Cannot allocate memory for vertices and triangles
BVH_ERR_BUILD_OUT_OF_SEQUENCE = -2, /// BVH construction does not follow correct sequence
BVH_ERR_BUILD_EMPTY_MODEL = -3, /// BVH geometry is not prepared
BVH_ERR_BUILD_EMPTY_PREVIOUS_FRAME = -4, /// BVH geometry in previous frame is not prepared
BVH_ERR_UNSUPPORTED_FUNCTION = -5, /// BVH funtion is not supported
BVH_ERR_UNUPDATED_MODEL = -6, /// BVH model update failed
BVH_ERR_INCORRECT_DATA = -7, /// BVH data is not valid
BVH_ERR_UNKNOWN = -8 /// Unknown failure
};
/** \brief BVH model type */
/// @brief BVH model type
enum BVHModelType
{
BVH_MODEL_UNKNOWN,
BVH_MODEL_TRIANGLES,
BVH_MODEL_POINTCLOUD
};
{
BVH_MODEL_UNKNOWN, /// @brief unknown model type
BVH_MODEL_TRIANGLES, /// @brief triangle model
BVH_MODEL_POINTCLOUD /// @brief point cloud model
};
}
......
......@@ -47,33 +47,16 @@
#include <vector>
#include <boost/shared_ptr.hpp>
/** \brief Main namespace */
namespace fcl
{
/** \brief A class describing the bounding hierarchy of a mesh model */
/// @brief 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<typename BV>
class BVHModel : public CollisionGeometry
{
private:
int num_tris_allocated;
int num_vertices_allocated;
int num_bvs_allocated;
int num_vertex_updated; // for ccd vertex update
unsigned int* primitive_indices;
public:
/** \brief The state of BVH building process */
BVHBuildState build_state;
/** \brief Split rule to split one BV node into two children */
boost::shared_ptr<BVSplitterBase<BV> > bv_splitter;
/** \brief Fitting rule to fit a BV node to a set of geometry primitives */
boost::shared_ptr<BVFitterBase<BV> > bv_fitter;
/** \brief Model type */
/// @brief Model type described by the instance
BVHModelType getModelType() const
{
if(num_tris && num_vertices)
......@@ -84,32 +67,29 @@ public:
return BVH_MODEL_UNKNOWN;
}
/** \brief Constructing an empty BVH */
BVHModel()
/// @brief Constructing an empty BVH
BVHModel() : vertices(NULL),
tri_indices(NULL),
prev_vertices(NULL),
num_tris(0),
num_vertices(0),
build_state(BVH_BUILD_STATE_EMPTY),
bv_splitter(new BVSplitter<BV>(SPLIT_METHOD_MEAN)),
bv_fitter(new BVFitter<BV>()),
num_tris_allocated(0),
num_vertices_allocated(0),
num_bvs_allocated(0),
num_vertex_updated(0),
primitive_indices(NULL),
bvs(NULL),
num_bvs(0)
{
vertices = NULL;
tri_indices = NULL;
bvs = NULL;
num_tris = 0;
num_tris_allocated = 0;
num_vertices = 0;
num_vertices_allocated = 0;
num_bvs = 0;
num_bvs_allocated = 0;
prev_vertices = NULL;
primitive_indices = NULL;
build_state = BVH_BUILD_STATE_EMPTY;
bv_splitter.reset(new BVSplitter<BV>(SPLIT_METHOD_MEAN));
bv_fitter.reset(new BVFitter<BV>());
}
BVHModel(const BVHModel& other);
/// @brief copy from another BVH
BVHModel(const BVHModel& other);
/// @brief deconstruction, delete mesh data related.
~BVHModel()
{
delete [] vertices;
......@@ -117,162 +97,185 @@ public:
delete [] bvs;
delete [] prev_vertices;
delete [] primitive_indices;
}
/** \brief We provide getBV() and getNumBVs() because BVH may be compressed (in future), so
we must provide some flexibility here */
/// @brief We provide getBV() and getNumBVs() because BVH may be compressed (in future), so we must provide some flexibility here
/** \brief Get the BV of index id */
/// @brief Access the bv giving the its index
const BVNode<BV>& getBV(int id) const
{
return bvs[id];
}
/** \brief Get the BV of index id */
/// @brief Access the bv giving the its index
BVNode<BV>& getBV(int id)
{
return bvs[id];
}
/** \brief Get the number of BVs */
/// @brief Get the number of bv in the BVH
int getNumBVs() const
{
return num_bvs;
}
/** \brief Get the object type: it is a BVH */
/// @brief Get the object type: it is a BVH
OBJECT_TYPE getObjectType() const { return OT_BVH; }
/** \brief Get the BV type */
/// @brief Get the BV type: default is unknown
NODE_TYPE getNodeType() const { return BV_UNKNOWN; }
/** \brief Compute the AABB for the BVH, used for broad-phase collision */
/// @brief Compute the AABB for the BVH, used for broad-phase collision
void computeLocalAABB();
/** \brief Geometry point data */
Vec3f* vertices;
/** \brief Geometry triangle index data, will be NULL for point clouds */
Triangle* tri_indices;
/** \brief Geometry point data in previous frame */
Vec3f* prev_vertices;
/** \brief Number of triangles */
int num_tris;
/** \brief Number of points */
int num_vertices;
/** \brief Begin a new BVH model */
/// @brief Begin a new BVH model
int beginModel(int num_tris = 0, int num_vertices = 0);
/** \brief Add one point in the new BVH model */
/// @brief Add one point in the new BVH model
int addVertex(const Vec3f& p);
/** \brief Add one triangle in the new BVH model */
/// @brief Add one triangle in the new BVH model
int addTriangle(const Vec3f& p1, const Vec3f& p2, const Vec3f& p3);
/** \brief Add a set of triangles in the new BVH model */
/// @brief Add a set of triangles in the new BVH model
int addSubModel(const std::vector<Vec3f>& ps, const std::vector<Triangle>& ts);
/** \brief Add a set of points in the new BVH model */
/// @brief Add a set of points in the new BVH model
int addSubModel(const std::vector<Vec3f>& ps);
/** \brief End BVH model construction, will build the bounding volume hierarchy */
/// @brief End BVH model construction, will build the bounding volume hierarchy
int endModel();
/** \brief Replace the geometry information of current frame (i.e. should have the same mesh topology with the previous frame) */
/// @brief Replace the geometry information of current frame (i.e. should have the same mesh topology with the previous frame)
int beginReplaceModel();
/** \brief Replace one point in the old BVH model */
/// @brief Replace one point in the old BVH model
int replaceVertex(const Vec3f& p);
/** \brief Replace one triangle in the old BVH model */
/// @brief Replace one triangle in the old BVH model
int replaceTriangle(const Vec3f& p1, const Vec3f& p2, const Vec3f& p3);
/** \brief Replace a set of points in the old BVH model */
/// @brief Replace a set of points in the old BVH model
int replaceSubModel(const std::vector<Vec3f>& ps);
/** \brief End BVH model replacement, will also refit or rebuild the bounding volume hierarchy */
/// @brief End BVH model replacement, will also refit or rebuild the bounding volume hierarchy
int endReplaceModel(bool refit = true, bool bottomup = true);
/** \brief 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.
* */
/// @brief 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 beginUpdateModel();
/** \brief Update one point in the old BVH model */
/// @brief Update one point in the old BVH model
int updateVertex(const Vec3f& p);
/** \brief Update one triangle in the old BVH model */
/// @brief Update one triangle in the old BVH model
int updateTriangle(const Vec3f& p1, const Vec3f& p2, const Vec3f& p3);
/** \brief Update a set of points in the old BVH model */
/// @brief Update a set of points in the old BVH model
int updateSubModel(const std::vector<Vec3f>& ps);
/** \brief End BVH model update, will also refit or rebuild the bounding volume hierarchy */
/// @brief End BVH model update, will also refit or rebuild the bounding volume hierarchy
int endUpdateModel(bool refit = true, bool bottomup = true);
/** \brief Check the number of memory used */
/// @brief Check the number of memory used
int memUsage(int msg) const;
/// @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
/// BV node. When traversing the BVH, this can save one matrix transformation.
void makeParentRelative()
{
makeParentRelativeRecurse(0, Matrix3f::getIdentity(), Vec3f());
Vec3f I[3] = {Vec3f(1, 0, 0), Vec3f(0, 1, 0), Vec3f(0, 0, 1)};
makeParentRelativeRecurse(0, I, Vec3f());
}
public:
/// @brief Geometry point data
Vec3f* vertices;
/// @brief Geometry triangle index data, will be NULL for point clouds
Triangle* tri_indices;
/// @brief Geometry point data in previous frame
Vec3f* prev_vertices;
/// @brief Number of triangles
int num_tris;
/// @brief Number of points
int num_vertices;
/// @brief The state of BVH building process
BVHBuildState build_state;
/// @brief Split rule to split one BV node into two children
boost::shared_ptr<BVSplitterBase<BV> > bv_splitter;
/// @brief Fitting rule to fit a BV node to a set of geometry primitives
boost::shared_ptr<BVFitterBase<BV> > bv_fitter;
private:
/** \brief Bounding volume hierarchy */
int num_tris_allocated;
int num_vertices_allocated;
int num_bvs_allocated;
int num_vertex_updated; /// for ccd vertex update
unsigned int* primitive_indices;
/// @brief Bounding volume hierarchy
BVNode<BV>* bvs;
/** \brief Number of BV nodes in bounding volume hierarchy */
/// @brief Number of BV nodes in bounding volume hierarchy
int num_bvs;
/** \brief Build the bounding volume hierarchy */
/// @brief Build the bounding volume hierarchy
int buildTree();
/** \brief Refit the bounding volume hierarchy */
/// @brief Refit the bounding volume hierarchy
int refitTree(bool bottomup);
/** \brief Refit the bounding volume hierarchy in a top-down way (slow but more compact)*/
/// @brief Refit the bounding volume hierarchy in a top-down way (slow but more compact)
int refitTree_topdown();
/** \brief Refit the bounding volume hierarchy in a bottom-up way (fast but less compact) */
/// @brief Refit the bounding volume hierarchy in a bottom-up way (fast but less compact)
int refitTree_bottomup();
/** \brief Recursive kernel for hierarchy construction */
/// @brief Recursive kernel for hierarchy construction
int recursiveBuildTree(int bv_id, int first_primitive, int num_primitives);
/** \brief Recursive kernel for bottomup refitting */
/// @brief Recursive kernel for bottomup refitting
int recursiveRefitTree_bottomup(int bv_id);
void makeParentRelativeRecurse(int bv_id, const Matrix3f& parentR, const Vec3f& parentT)
/// @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, Vec3f parent_axis[], const Vec3f& parent_c)
{
if(!bvs[bv_id].isLeaf())
{
makeParentRelativeRecurse(bvs[bv_id].first_child, bvs[bv_id].getOrientation(), bvs[bv_id].getCenter());
makeParentRelativeRecurse(bvs[bv_id].first_child, parent_axis, bvs[bv_id].getCenter());
makeParentRelativeRecurse(bvs[bv_id].first_child + 1, bvs[bv_id].getOrientation(), bvs[bv_id].getCenter());
makeParentRelativeRecurse(bvs[bv_id].first_child + 1, parent_axis, bvs[bv_id].getCenter());
}
// make self parent relative
Matrix3f Rpc = parentR.transposeTimes(bvs[bv_id].getOrientation());
bvs[bv_id].setOrientation(Rpc);
Vec3f Tpc = bvs[bv_id].getCenter() - parentT;
bvs[bv_id].setCenter(parentR.transposeTimes(Tpc));
bvs[bv_id].bv = translate(bvs[bv_id].bv, -parent_c);
}
};
/** Specialization of getNodeType() for BVHModel with different BV types */
template<>
void BVHModel<OBB>::makeParentRelativeRecurse(int bv_id, Vec3f parent_axis[], const Vec3f& parent_c);
template<>
void BVHModel<RSS>::makeParentRelativeRecurse(int bv_id, Vec3f parent_axis[], const Vec3f& parent_c);
template<>
void BVHModel<OBBRSS>::makeParentRelativeRecurse(int bv_id, Vec3f parent_axis[], const Vec3f& parent_c);
/// @brief Specialization of getNodeType() for BVHModel with different BV types
template<>
NODE_TYPE BVHModel<AABB>::getNodeType() const;
......
......@@ -44,7 +44,7 @@
namespace fcl
{
/** \brief Expand the BVH bounding boxes according to uncertainty */
/// @brief Expand the BVH bounding boxes according to the variance matrix corresponding to the data stored within each BV node
template<typename BV>
void BVHExpand(BVHModel<BV>& model, const Variance3f* ucs, FCL_REAL r)
{
......@@ -71,33 +71,29 @@ void BVHExpand(BVHModel<BV>& model, const Variance3f* ucs, FCL_REAL r)
}
}
/** \brief Expand the BVH bounding boxes according to uncertainty, for OBB */
/// @brief Expand the BVH bounding boxes according to the corresponding variance information, for OBB
void BVHExpand(BVHModel<OBB>& model, const Variance3f* ucs, FCL_REAL r);
/** \brief Expand the BVH bounding boxes according to uncertainty, for RSS */
/// @brief Expand the BVH bounding boxes according to the corresponding variance information, for RSS
void BVHExpand(BVHModel<RSS>& model, const Variance3f* ucs, FCL_REAL r);
/** \brief Estimate the uncertainty of point clouds due to sampling procedure */
void estimateSamplingUncertainty(Vec3f* vertices, int num_vertices, Variance3f* ucs);
/// @brief Estimate the variance of point clouds due to sampling procedure
void estimateSamplingVariance(Vec3f* vertices, int num_vertices, Variance3f* ucs);
/** \brief Compute the covariance matrix for a set or subset of points. if ts = null, then indices refer to points directly; otherwise refer to triangles */
/// @brief Compute the covariance matrix for a set or subset of points. if ts = null, then indices refer to points directly; otherwise refer to triangles
void getCovariance(Vec3f* ps, Vec3f* ps2, Triangle* ts, unsigned int* indices, int n, Matrix3f& M);
/** \brief Compute the RSS bounding volume parameters: radius, rectangle size and the origin.
* The bounding volume axes are known.
*/
/// @brief Compute the RSS bounding volume parameters: radius, rectangle size and the origin, given the BV axises.
void getRadiusAndOriginAndRectangleSize(Vec3f* ps, Vec3f* ps2, Triangle* ts, unsigned int* indices, int n, Vec3f axis[3], Vec3f& origin, FCL_REAL l[2], FCL_REAL& r);
/** \brief Compute the bounding volume extent and center for a set or subset of points.
* The bounding volume axes are known.
*/
/// @brief Compute the bounding volume extent and center for a set or subset of points, given the BV axises.
void getExtentAndCenter(Vec3f* ps, Vec3f* ps2, Triangle* ts, unsigned int* indices, int n, Vec3f axis[3], Vec3f& center, Vec3f& extent);
/** \brief Compute the center and radius for a triangle's circumcircle */
/// @brief Compute the center and radius for a triangle's circumcircle
void circumCircleComputation(const Vec3f& a, const Vec3f& b, const Vec3f& c, Vec3f& center, FCL_REAL& radius);
/** \brief Compute the maximum distance from a given center point to a point cloud */
/// @brief Compute the maximum distance from a given center point to a point cloud
FCL_REAL maximumDistance(Vec3f* ps, Vec3f* ps2, Triangle* ts, unsigned int* indices, int n, const Vec3f& query);
......
......@@ -47,11 +47,10 @@
#include "fcl/BV/OBBRSS.h"
#include <iostream>
/** \brief Main namespace */
namespace fcl
{
/** \brief Compute a bounding volume that fits a set of n points. */
/// @brief Compute a bounding volume that fits a set of n points.
template<typename BV>
void fit(Vec3f* ps, int n, BV& bv)
{
......@@ -74,28 +73,33 @@ template<>
void fit<OBBRSS>(Vec3f* ps, int n, OBBRSS& bv);
/// @brief Interface for fitting a bv given the triangles or points inside it.
template<typename BV>
class BVFitterBase
{
public:
/// @brief Set the primitives to be processed by the fitter
virtual void set(Vec3f* vertices_, Triangle* tri_indices_, BVHModelType type_) = 0;
/// @brief Set the primitives to be processed by the fitter, for deformable mesh.
virtual void set(Vec3f* vertices_, Vec3f* prev_vertices_, Triangle* tri_indices_, BVHModelType type_) = 0;
/// @brief Compute the fitting BV
virtual BV fit(unsigned int* primitive_indices, int num_primitives) = 0;
/// @brief clear the temporary data generated.
virtual void clear() = 0;
};
/** \brief A class for fitting a bounding volume to a set of points */
/// @brief The class for the default algorithm fitting a bounding volume to a set of points
template<typename BV>
class BVFitter : public BVFitterBase<BV>
{
public:
/** \brief default deconstructor */
/// @brief default deconstructor
virtual ~BVFitter() {}
/** \brief Prepare the geometry primitive data for fitting */
/// @brief Prepare the geometry primitive data for fitting
void set(Vec3f* vertices_, Triangle* tri_indices_, BVHModelType type_)
{
vertices = vertices_;
......@@ -104,7 +108,7 @@ public:
type = type_;
}
/** \brief Prepare the geometry primitive data for fitting */
/// @brief Prepare the geometry primitive data for fitting, for deformable mesh
void set(Vec3f* vertices_, Vec3f* prev_vertices_, Triangle* tri_indices_, BVHModelType type_)
{
vertices = vertices_;
......@@ -113,14 +117,13 @@ public:
type = type_;
}
/** \brief Compute a bounding volume that fits a set of primitives (points or triangles).