38 #ifndef FCL_BVH_MODEL_INL_H 39 #define FCL_BVH_MODEL_INL_H 41 #include "fcl/geometry/bvh/BVH_model.h" 47 template <
typename BV>
50 if(num_tris && num_vertices)
55 return BVH_MODEL_UNKNOWN;
59 template <
typename BV>
62 prev_vertices(nullptr),
65 build_state(BVH_BUILD_STATE_EMPTY),
66 bv_splitter(new detail::BVSplitter<BV>(detail::SPLIT_METHOD_MEAN)),
67 bv_fitter(new detail::BVFitter<BV>()),
68 num_tris_allocated(0),
69 num_vertices_allocated(0),
71 num_vertex_updated(0),
72 primitive_indices(nullptr),
80 template <
typename BV>
115 if(other.primitive_indices)
117 int num_primitives = 0;
130 primitive_indices =
new unsigned int[num_primitives];
131 memcpy(primitive_indices, other.primitive_indices,
sizeof(
unsigned int) * num_primitives);
134 primitive_indices =
nullptr;
136 num_bvs = num_bvs_allocated = other.num_bvs;
140 memcpy(bvs, other.bvs,
sizeof(
BVNode<BV>) * num_bvs);
147 template <
typename BV>
155 delete [] primitive_indices;
159 template <
typename BV>
166 template <
typename BV>
173 template <
typename BV>
180 template <
typename BV>
187 template <
typename BV>
197 template <
typename BV>
204 template <
typename BV>
211 delete [] bvs; bvs =
nullptr;
213 delete [] primitive_indices; primitive_indices =
nullptr;
215 num_vertices_allocated =
num_vertices = num_tris_allocated =
num_tris = num_bvs_allocated = num_bvs = 0;
218 if(num_tris_ <= 0) num_tris_ = 8;
219 if(num_vertices_ <= 0) num_vertices_ = 8;
221 num_vertices_allocated = num_vertices_;
222 num_tris_allocated = num_tris_;
225 vertices =
new Vector3<S>[num_vertices_allocated];
229 std::cerr <<
"BVH Error! Out of memory for tri_indices array on BeginModel() call!" << std::endl;
234 std::cerr <<
"BVH Error! Out of memory for vertices array on BeginModel() call!" << std::endl;
240 std::cerr <<
"BVH Warning! Call beginModel() on a BVHModel that is not empty. This model was cleared and previous triangles/vertices were lost." << std::endl;
251 template <
typename BV>
256 std::cerr <<
"BVH Warning! Call addVertex() in a wrong order. addVertex() was ignored. Must do a beginModel() to clear the model for addition of new vertices." << std::endl;
262 Vector3<S>* temp =
new Vector3<S>[num_vertices_allocated * 2];
265 std::cerr <<
"BVH Error! Out of memory for vertices array on addVertex() call!" << std::endl;
272 num_vertices_allocated *= 2;
282 template <
typename BV>
287 std::cerr <<
"BVH Warning! Call addTriangle() in a wrong order. addTriangle() was ignored. Must do a beginModel() to clear the model for addition of new triangles." << std::endl;
293 Vector3<S>* temp =
new Vector3<S>[num_vertices_allocated * 2 + 2];
296 std::cerr <<
"BVH Error! Out of memory for vertices array on addTriangle() call!" << std::endl;
303 num_vertices_allocated = num_vertices_allocated * 2 + 2;
320 std::cerr <<
"BVH Error! Out of memory for tri_indices array on addTriangle() call!" << std::endl;
327 num_tris_allocated *= 2;
337 template <
typename BV>
342 std::cerr <<
"BVH Warning! Call addSubModel() in a wrong order. addSubModel() was ignored. Must do a beginModel() to clear the model for addition of new vertices." << std::endl;
346 int num_vertices_to_add = ps.size();
348 if(
num_vertices + num_vertices_to_add - 1 >= num_vertices_allocated)
350 Vector3<S>* temp =
new Vector3<S>[num_vertices_allocated * 2 + num_vertices_to_add - 1];
353 std::cerr <<
"BVH Error! Out of memory for vertices array on addSubModel() call!" << std::endl;
360 num_vertices_allocated = num_vertices_allocated * 2 + num_vertices_to_add - 1;
363 for(
int i = 0; i < num_vertices_to_add; ++i)
373 template <
typename BV>
378 std::cerr <<
"BVH Warning! Call addSubModel() in a wrong order. addSubModel() was ignored. Must do a beginModel() to clear the model for addition of new vertices." << std::endl;
382 int num_vertices_to_add = ps.size();
384 if(
num_vertices + num_vertices_to_add - 1 >= num_vertices_allocated)
386 Vector3<S>* temp =
new Vector3<S>[num_vertices_allocated * 2 + num_vertices_to_add - 1];
389 std::cerr <<
"BVH Error! Out of memory for vertices array on addSubModel() call!" << std::endl;
396 num_vertices_allocated = num_vertices_allocated * 2 + num_vertices_to_add - 1;
401 for(
int i = 0; i < num_vertices_to_add; ++i)
408 int num_tris_to_add = ts.size();
410 if(
num_tris + num_tris_to_add - 1 >= num_tris_allocated)
412 Triangle* temp =
new Triangle[num_tris_allocated * 2 + num_tris_to_add - 1];
415 std::cerr <<
"BVH Error! Out of memory for tri_indices array on addSubModel() call!" << std::endl;
422 num_tris_allocated = num_tris_allocated * 2 + num_tris_to_add - 1;
425 for(
int i = 0; i < num_tris_to_add; ++i)
436 template <
typename BV>
441 std::cerr <<
"BVH Warning! Call endModel() in wrong order. endModel() was ignored." << std::endl;
447 std::cerr <<
"BVH Error! endModel() called on model with no triangles and vertices." << std::endl;
456 std::cerr <<
"BVH Error! Out of memory for tri_indices array in endModel() call!" << std::endl;
467 Vector3<S>* new_vertices =
new Vector3<S>[
num_vertices];
470 std::cerr <<
"BVH Error! Out of memory for vertices array in endModel() call!" << std::endl;
481 int num_bvs_to_be_allocated = 0;
485 num_bvs_to_be_allocated = 2 *
num_tris - 1;
488 bvs =
new BVNode<BV> [num_bvs_to_be_allocated];
489 primitive_indices =
new unsigned int [num_bvs_to_be_allocated];
490 if(!bvs || !primitive_indices)
492 std::cerr <<
"BVH Error! Out of memory for BV array in endModel()!" << std::endl;
495 num_bvs_allocated = num_bvs_to_be_allocated;
507 template <
typename BV>
512 std::cerr <<
"BVH Error! Call beginReplaceModel() on a BVHModel that has no previous frame." << std::endl;
518 num_vertex_updated = 0;
526 template <
typename BV>
531 std::cerr <<
"BVH Warning! Call replaceVertex() in a wrong order. replaceVertex() was ignored. Must do a beginReplaceModel() for initialization." << std::endl;
536 num_vertex_updated++;
542 template <
typename BV>
547 std::cerr <<
"BVH Warning! Call replaceTriangle() in a wrong order. replaceTriangle() was ignored. Must do a beginReplaceModel() for initialization." << std::endl;
551 vertices[num_vertex_updated] = p1; num_vertex_updated++;
552 vertices[num_vertex_updated] = p2; num_vertex_updated++;
553 vertices[num_vertex_updated] = p3; num_vertex_updated++;
558 template <
typename BV>
563 std::cerr <<
"BVH Warning! Call replaceSubModel() in a wrong order. replaceSubModel() was ignored. Must do a beginReplaceModel() for initialization." << std::endl;
567 for(
unsigned int i = 0; i < ps.size(); ++i)
569 vertices[num_vertex_updated] = ps[i];
570 num_vertex_updated++;
576 template <
typename BV>
581 std::cerr <<
"BVH Warning! Call endReplaceModel() in a wrong order. endReplaceModel() was ignored. " << std::endl;
587 std::cerr <<
"BVH Error! The replaced model should have the same number of vertices as the old model." << std::endl;
606 template <
typename BV>
611 std::cerr <<
"BVH Error! Call beginUpdatemodel() on a BVHModel that has no previous frame." << std::endl;
627 num_vertex_updated = 0;
635 template <
typename BV>
640 std::cerr <<
"BVH Warning! Call updateVertex() in a wrong order. updateVertex() was ignored. Must do a beginUpdateModel() for initialization." << std::endl;
645 num_vertex_updated++;
651 template <
typename BV>
656 std::cerr <<
"BVH Warning! Call updateTriangle() in a wrong order. updateTriangle() was ignored. Must do a beginUpdateModel() for initialization." << std::endl;
660 vertices[num_vertex_updated] = p1; num_vertex_updated++;
661 vertices[num_vertex_updated] = p2; num_vertex_updated++;
662 vertices[num_vertex_updated] = p3; num_vertex_updated++;
667 template <
typename BV>
672 std::cerr <<
"BVH Warning! Call updateSubModel() in a wrong order. updateSubModel() was ignored. Must do a beginUpdateModel() for initialization." << std::endl;
676 for(
unsigned int i = 0; i < ps.size(); ++i)
678 vertices[num_vertex_updated] = ps[i];
679 num_vertex_updated++;
685 template <
typename BV>
690 std::cerr <<
"BVH Warning! Call endUpdateModel() in a wrong order. endUpdateModel() was ignored. " << std::endl;
696 std::cerr <<
"BVH Error! The updated model should have the same number of vertices as the old model." << std::endl;
720 template <
typename BV>
723 int mem_bv_list =
sizeof(BV) * num_bvs;
725 int mem_vertex_list =
sizeof(Vector3<S>) *
num_vertices;
727 int total_mem = mem_bv_list + mem_tri_list + mem_vertex_list +
sizeof(
BVHModel<BV>);
730 std::cerr <<
"Total for model " << total_mem <<
" bytes." << std::endl;
731 std::cerr <<
"BVs: " << num_bvs <<
" allocated." << std::endl;
732 std::cerr <<
"Tris: " <<
num_tris <<
" allocated." << std::endl;
733 std::cerr <<
"Vertices: " <<
num_vertices <<
" allocated." << std::endl;
740 template <
typename BV>
743 makeParentRelativeRecurse(
744 0, Matrix3<S>::Identity(), Vector3<S>::Zero());
748 template <
typename BV>
752 Vector3<S> com = Vector3<S>::Zero();
761 return com / (vol * 4);
765 template <
typename BV>
780 template <
typename BV>
783 Matrix3<S> C = Matrix3<S>::Zero();
785 Matrix3<S> C_canonical;
786 C_canonical << 1/ 60.0, 1/120.0, 1/120.0,
787 1/120.0, 1/ 60.0, 1/120.0,
788 1/120.0, 1/120.0, 1/ 60.0;
793 const Vector3<S>& v1 =
vertices[tri[0]];
794 const Vector3<S>& v2 =
vertices[tri[1]];
795 const Vector3<S>& v3 =
vertices[tri[2]];
796 S d_six_vol = (v1.cross(v2)).dot(v3);
801 C.noalias() += A.transpose() * C_canonical * A * d_six_vol;
804 S trace_C = C(0, 0) + C(1, 1) + C(2, 2);
807 m << trace_C - C(0, 0), -C(0, 1), -C(0, 2),
808 -C(1, 0), trace_C - C(1, 1), -C(1, 2),
809 -C(2, 0), -C(2, 1), trace_C - C(2, 2);
815 template <
typename BV>
825 int num_primitives = 0;
835 std::cerr <<
"BVH Error: Model type not supported!" << std::endl;
839 for(
int i = 0; i < num_primitives; ++i)
840 primitive_indices[i] = i;
841 recursiveBuildTree(0, 0, num_primitives);
850 template <
typename BV>
855 unsigned int* cur_primitive_indices = primitive_indices + first_primitive;
858 BV bv =
bv_fitter->fit(cur_primitive_indices, num_primitives);
859 bv_splitter->computeRule(bv, cur_primitive_indices, num_primitives);
865 if(num_primitives == 1)
867 bvnode->
first_child = -((*cur_primitive_indices) + 1);
875 for(
int i = 0; i < num_primitives; ++i)
882 const Vector3<S>& p1 =
vertices[t[0]];
883 const Vector3<S>& p2 =
vertices[t[1]];
884 const Vector3<S>& p3 =
vertices[t[2]];
885 p.noalias() = (p1 + p2 + p3) / 3.0;
889 std::cerr <<
"BVH Error: Model type not supported!" << std::endl;
906 std::swap(cur_primitive_indices[i], cur_primitive_indices[c1]);
912 if((c1 == 0) || (c1 == num_primitives)) c1 = num_primitives / 2;
914 int num_first_half = c1;
916 recursiveBuildTree(bvnode->
leftChild(), first_primitive, num_first_half);
917 recursiveBuildTree(bvnode->
rightChild(), first_primitive + num_first_half, num_primitives - num_first_half);
924 template <
typename BV>
928 return refitTree_bottomup();
930 return refitTree_topdown();
934 template <
typename BV>
937 int res = recursiveRefitTree_bottomup(0);
943 template <
typename BV>
975 for(
int i = 0; i < 3; ++i)
986 for(
int i = 0; i < 3; ++i)
998 std::cerr <<
"BVH Error: Model type not supported!" << std::endl;
1004 recursiveRefitTree_bottomup(bvnode->
leftChild());
1005 recursiveRefitTree_bottomup(bvnode->
rightChild());
1013 template <
typename S,
typename BV>
1018 const Matrix3<S>& parent_axis,
1019 const Vector3<S>& parent_c)
1021 if(!model.bvs[bv_id].isLeaf())
1024 tmp1(model, model.bvs[bv_id].first_child, parent_axis, model.bvs[bv_id].getCenter());
1027 tmp2(model, model.bvs[bv_id].first_child + 1, parent_axis, model.bvs[bv_id].getCenter());
1030 model.bvs[bv_id].bv =
translate(model.bvs[bv_id].bv, -parent_c);
1035 template <
typename BV>
1038 const Matrix3<S>& parent_axis,
1039 const Vector3<S>& parent_c)
1042 *
this, bv_id, parent_axis, parent_c);
1046 template <
typename BV>
1050 for(
int i = 0; i < num_bvs; ++i)
1052 BV bv =
bv_fitter->fit(primitive_indices + bvs[i].first_primitive, bvs[i].num_primitives);
1062 template <
typename BV>
1086 template <
typename S>
1091 const Matrix3<S>& parent_axis,
1092 const Vector3<S>& parent_c)
1094 OBB<S>& obb = model.bvs[bv_id].bv;
1095 if(!model.bvs[bv_id].isLeaf())
1098 tmp1(model, model.bvs[bv_id].first_child, obb.
axis, obb.
To);
1101 tmp2(model, model.bvs[bv_id].first_child + 1, obb.
axis, obb.
To);
1105 obb.
axis = parent_axis.transpose() * obb.
axis;
1106 obb.
To = (obb.
To - parent_c).transpose() * parent_axis;
1111 template <
typename S>
1116 const Matrix3<S>& parent_axis,
1117 const Vector3<S>& parent_c)
1119 RSS<S>& rss = model.bvs[bv_id].bv;
1120 if(!model.bvs[bv_id].isLeaf())
1123 tmp1(model, model.bvs[bv_id].first_child, rss.
axis, rss.
To);
1126 tmp2(model, model.bvs[bv_id].first_child + 1, rss.
axis, rss.
To);
1130 rss.
axis = parent_axis.transpose() * rss.
axis;
1131 rss.
To = (rss.
To - parent_c).transpose() * parent_axis;
1136 template <
typename S>
1141 const Matrix3<S>& parent_axis,
1142 const Vector3<S>& parent_c)
1144 OBB<S>& obb = model.bvs[bv_id].bv.obb;
1145 RSS<S>& rss = model.bvs[bv_id].bv.rss;
1146 if(!model.bvs[bv_id].isLeaf())
1149 tmp1(model, model.bvs[bv_id].first_child, obb.
axis, obb.
To);
1152 tmp2(model, model.bvs[bv_id].first_child + 1, obb.
axis, obb.
To);
1156 obb.
axis = parent_axis.transpose() * obb.
axis;
1159 obb.
To = (obb.
To - parent_c).transpose() * parent_axis;
1165 template <
typename S>
1175 template <
typename S>
1185 template <
typename S>
1195 template <
typename S>
1205 template <
typename S>
1215 template <
typename S>
1225 template <
typename S>
1235 template <
typename S>
void computeLocalAABB() override
Compute the AABB for the BVH, used for broad-phase collision.
Definition: BVH_model-inl.h:1063
int beginModel(int num_tris=0, int num_vertices=0)
Begin a new BVH model.
Definition: BVH_model-inl.h:205
Vector3< BV::S > aabb_center
AABB center in local coordinate.
Definition: collision_geometry.h:91
int updateSubModel(const std::vector< Vector3< S >> &ps)
Update a set of points in the old BVH model.
Definition: BVH_model-inl.h:668
NODE_TYPE
traversal node type: bounding volume (AABB, OBB, RSS, kIOS, OBBRSS, KDOP16, KDOP18, kDOP24), basic shape (box, sphere, ellipsoid, capsule, cone, cylinder, convex, plane, halfspace, triangle), and octree
Definition: collision_geometry.h:54
void set(std::size_t p1, std::size_t p2, std::size_t p3)
Set the vertex indices of the triangle.
Definition: triangle.cpp:56
Matrix3< S > computeMomentofInertia() const override
compute the inertia matrix, related to the origin
Definition: BVH_model-inl.h:781
int addVertex(const Vector3< S > &p)
Add one point in the new BVH model.
Definition: BVH_model-inl.h:252
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
int replaceSubModel(const std::vector< Vector3< S >> &ps)
Replace a set of points in the old BVH model.
Definition: BVH_model-inl.h:559
int rightChild() const
Return the index of the second child. The index is referred to the bounding volume array (i...
Definition: BV_node_base.cpp:62
triangle model
Definition: BVH_internal.h:79
int leftChild() const
Return the index of the first child. The index is referred to the bounding volume array (i...
Definition: BV_node_base.cpp:56
int replaceVertex(const Vector3< S > &p)
Replace one point in the old BVH model.
Definition: BVH_model-inl.h:527
BV::S aabb_radius
AABB radius.
Definition: collision_geometry.h:94
int getNumBVs() const
Get the number of bv in the BVH.
Definition: BVH_model-inl.h:174
int beginReplaceModel()
Replace the geometry information of current frame (i.e. should have the same mesh topology with the p...
Definition: BVH_model-inl.h:508
BVHModelType getModelType() const
Model type described by the instance.
Definition: BVH_model-inl.h:48
AABB< S > translate(const AABB< S > &aabb, const Eigen::MatrixBase< Derived > &t)
translate the center of AABB by t
Definition: AABB-inl.h:345
OBJECT_TYPE getObjectType() const override
Get the object type: it is a BVH.
Definition: BVH_model-inl.h:181
BVHModelType
BVH model type.
Definition: BVH_internal.h:75
BVHModel()
Constructing an empty BVH.
Definition: BVH_model-inl.h:60
const BVNode< BV > & getBV(int id) const
We provide getBV() and getNumBVs() because BVH may be compressed (in future), so we must provide some...
Definition: BVH_model-inl.h:160
Vector3< S > * prev_vertices
Geometry point data in previous frame.
Definition: BVH_model.h:168
BVH model update failed.
Definition: BVH_internal.h:70
Vector3< S > center() const
Center of the AABB.
Definition: AABB-inl.h:230
Vector3< S > * vertices
Geometry point data.
Definition: BVH_model.h:162
int num_vertices
Number of points.
Definition: BVH_model.h:174
void makeParentRelative()
This is a special acceleration: BVH_model default stores the BV's transform in world coordinate...
Definition: BVH_model-inl.h:741
int addSubModel(const std::vector< Vector3< S >> &ps, const std::vector< Triangle > &ts)
Add a set of triangles in the new BVH model.
Definition: BVH_model-inl.h:374
int addTriangle(const Vector3< S > &p1, const Vector3< S > &p2, const Vector3< S > &p3)
Add one triangle in the new BVH model.
Definition: BVH_model-inl.h:283
BVH geometry is not prepared.
Definition: BVH_internal.h:67
The geometry for the object for collision or distance computation.
Definition: collision_geometry.h:59
Cannot allocate memory for vertices and triangles.
Definition: BVH_internal.h:65
Triangle * tri_indices
Geometry triangle index data, will be nullptr for point clouds.
Definition: BVH_model.h:165
Triangle with 3 indices for points.
Definition: triangle.h:47
void fit(Vector3< typename BV::S > *ps, int n, BV &bv)
Compute a bounding volume that fits a set of n points.
Definition: utility-inl.h:647
BVH geometry in previous frame is not prepared.
Definition: BVH_internal.h:68
unknown model type
Definition: BVH_internal.h:78
int num_tris
Number of triangles.
Definition: BVH_model.h:171
std::shared_ptr< detail::BVFitterBase< BV > > bv_fitter
Fitting rule to fit a BV node to a set of geometry primitives.
Definition: BVH_model.h:183
int first_child
An index for first child node or primitive If the value is positive, it is the index of the first chi...
Definition: BV_node_base.h:56
KDOP class describes the KDOP collision structures. K is set as the template parameter, which should be 16, 18, or 24 The KDOP structure is defined by some pairs of parallel planes defined by some axes. For K = 16, the planes are 6 AABB planes and 10 diagonal planes that cut off some space of the edges: (-1,0,0) and (1,0,0) -> indices 0 and 8 (0,-1,0) and (0,1,0) -> indices 1 and 9 (0,0,-1) and (0,0,1) -> indices 2 and 10 (-1,-1,0) and (1,1,0) -> indices 3 and 11 (-1,0,-1) and (1,0,1) -> indices 4 and 12 (0,-1,-1) and (0,1,1) -> indices 5 and 13 (-1,1,0) and (1,-1,0) -> indices 6 and 14 (-1,0,1) and (1,0,-1) -> indices 7 and 15 For K = 18, the planes are 6 AABB planes and 12 diagonal planes that cut off some space of the edges: (-1,0,0) and (1,0,0) -> indices 0 and 9 (0,-1,0) and (0,1,0) -> indices 1 and 10 (0,0,-1) and (0,0,1) -> indices 2 and 11 (-1,-1,0) and (1,1,0) -> indices 3 and 12 (-1,0,-1) and (1,0,1) -> indices 4 and 13 (0,-1,-1) and (0,1,1) -> indices 5 and 14 (-1,1,0) and (1,-1,0) -> indices 6 and 15 (-1,0,1) and (1,0,-1) -> indices 7 and 16 (0,-1,1) and (0,1,-1) -> indices 8 and 17 For K = 18, the planes are 6 AABB planes and 18 diagonal planes that cut off some space of the edges: (-1,0,0) and (1,0,0) -> indices 0 and 12 (0,-1,0) and (0,1,0) -> indices 1 and 13 (0,0,-1) and (0,0,1) -> indices 2 and 14 (-1,-1,0) and (1,1,0) -> indices 3 and 15 (-1,0,-1) and (1,0,1) -> indices 4 and 16 (0,-1,-1) and (0,1,1) -> indices 5 and 17 (-1,1,0) and (1,-1,0) -> indices 6 and 18 (-1,0,1) and (1,0,-1) -> indices 7 and 19 (0,-1,1) and (0,1,-1) -> indices 8 and 20 (-1, -1, 1) and (1, 1, -1) –> indices 9 and 21 (-1, 1, -1) and (1, -1, 1) –> indices 10 and 22 (1, -1, -1) and (-1, 1, 1) –> indices 11 and 23.
Definition: kDOP.h:84
int num_primitives
The number of primitives belonging to the current node.
Definition: BV_node_base.h:63
S computeVolume() const override
compute the volume
Definition: BVH_model-inl.h:766
int updateTriangle(const Vector3< S > &p1, const Vector3< S > &p2, const Vector3< S > &p3)
Update one triangle in the old BVH model.
Definition: BVH_model-inl.h:652
int memUsage(int msg) const
Check the number of memory used.
Definition: BVH_model-inl.h:721
OBJECT_TYPE
object type: BVH (mesh, points), basic geometry, octree
Definition: collision_geometry.h:51
after beginModel(), state for adding geometry primitives
Definition: BVH_internal.h:54
AABB< BV::S > aabb_local
AABB in local coordinate, used for tight AABB when only translation transform.
Definition: collision_geometry.h:97
A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as ...
Definition: BVH_model.h:57
int replaceTriangle(const Vector3< S > &p1, const Vector3< S > &p2, const Vector3< S > &p3)
Replace one triangle in the old BVH model.
Definition: BVH_model-inl.h:543
int updateVertex(const Vector3< S > &p)
Update one point in the old BVH model.
Definition: BVH_model-inl.h:636
BV bv
bounding volume storing the geometry
Definition: BV_node.h:57
Matrix3< S > axis
Orientation of OBB. The axes of the rotation matrix are the principle directions of the box...
Definition: OBB.h:62
after tree has been build, ready for cd use
Definition: BVH_internal.h:55
A class describing a bounding volume node. It includes the tree structure providing in BVNodeBase and...
Definition: BV_node.h:52
BVH is valid.
Definition: BVH_internal.h:64
Definition: BVH_model-inl.h:1014
int endModel()
End BVH model construction, will build the bounding volume hierarchy.
Definition: BVH_model-inl.h:437
NODE_TYPE getNodeType() const override
Get the BV type: default is unknown.
Definition: BVH_model-inl.h:198
int endUpdateModel(bool refit=true, bool bottomup=true)
End BVH model update, will also refit or rebuild the bounding volume hierarchy.
Definition: BVH_model-inl.h:686
BVH construction does not follow correct sequence.
Definition: BVH_internal.h:66
after tree has been build for updated geometry, ready for ccd use
Definition: BVH_internal.h:57
Definition: BVH_model-inl.h:188
empty state, immediately after constructor
Definition: BVH_internal.h:53
Vector3< S > computeCOM() const override
compute center of mass
Definition: BVH_model-inl.h:749
bool isLeaf() const
Whether current node is a leaf node (i.e. contains a primitive index.
Definition: BV_node_base.cpp:44
int endReplaceModel(bool refit=true, bool bottomup=true)
End BVH model replacement, will also refit or rebuild the bounding volume hierarchy.
Definition: BVH_model-inl.h:577
std::shared_ptr< detail::BVSplitterBase< BV > > bv_splitter
Split rule to split one BV node into two children.
Definition: BVH_model.h:180
Vector3< S > To
Center of OBB.
Definition: OBB.h:65
BVHBuildState build_state
The state of BVH building process.
Definition: BVH_model.h:177
after beginUpdateModel(), state for updating geometry primitives
Definition: BVH_internal.h:56
~BVHModel()
deconstruction, delete mesh data related.
Definition: BVH_model-inl.h:148
A class describing the kIOS collision structure, which is a set of spheres.
Definition: kIOS.h:48
int first_primitive
The start id the primitive belonging to the current node. The index is referred to the primitive_indi...
Definition: BV_node_base.h:60
int beginUpdateModel()
Replace the geometry information of current frame (i.e. should have the same mesh topology with the p...
Definition: BVH_model-inl.h:607
Oriented bounding box class.
Definition: OBB.h:51