38 #ifndef FCL_TRAVERSAL_MESHSHAPEDISTANCETRAVERSALNODE_INL_H
39 #define FCL_TRAVERSAL_MESHSHAPEDISTANCETRAVERSALNODE_INL_H
52 template <
typename BV,
typename Shape,
typename NarrowPhaseSolver>
58 tri_indices =
nullptr;
67 template <
typename BV,
typename Shape,
typename NarrowPhaseSolver>
73 if(this->enable_statistics) this->num_leaf_tests++;
75 const BVNode<BV>& node = this->model1->getBV(b1);
79 const Triangle& tri_id = tri_indices[primitive_id];
87 nsolver->shapeTriangleDistance(*(this->model2), this->tf2, p1, p2, p3, &d, &closest_p2, &closest_p1);
100 template <
typename BV,
typename Shape,
typename NarrowPhaseSolver>
104 if((c >= this->result->min_distance - abs_err) && (c * (1 + rel_err) >= this->result->min_distance))
110 template <
typename BV,
typename Shape,
typename NarrowPhaseSolver>
117 const NarrowPhaseSolver* nsolver,
123 using S =
typename BV::S;
128 if(!tf1.matrix().isIdentity())
130 std::vector<Vector3<S>> vertices_transformed1(model1.
num_vertices);
135 vertices_transformed1[i] = new_v;
163 template <
typename BV,
typename Shape,
typename NarrowPhaseSolver>
170 const NarrowPhaseSolver* nsolver,
171 bool enable_statistics,
172 int & num_leaf_tests,
176 using S =
typename BV::S;
178 if(enable_statistics) num_leaf_tests++;
183 const Triangle& tri_id = tri_indices[primitive_id];
190 nsolver->shapeTriangleDistance(model2, tf2, p1, p2, p3, tf1, &
distance, &closest_p2, &closest_p1);
203 template <
typename BV,
typename Shape,
typename NarrowPhaseSolver>
212 const NarrowPhaseSolver* nsolver,
216 using S =
typename BV::S;
218 const Triangle& init_tri = tri_indices[init_tri_id];
226 nsolver->shapeTriangleDistance(model2, tf2, p1, p2, p3, tf1, &
distance, &closest_p2, &closest_p1);
239 template <
typename Shape,
typename NarrowPhaseSolver>
240 MeshShapeDistanceTraversalNodeRSS<Shape, NarrowPhaseSolver>::
241 MeshShapeDistanceTraversalNodeRSS()
243 RSS<typename Shape::
S>, Shape, NarrowPhaseSolver>()
248 template <
typename Shape,
typename NarrowPhaseSolver>
265 template <
typename Shape,
typename NarrowPhaseSolver>
271 template <
typename Shape,
typename NarrowPhaseSolver>
274 int b1,
int b2)
const
278 if(this->enable_statistics) this->num_bv_tests++;
280 return distance(this->tf1.linear(), this->tf1.translation(), this->model2_bv, this->model1->getBV(b1).bv);
284 template <
typename Shape,
typename NarrowPhaseSolver>
298 this->enable_statistics,
299 this->num_leaf_tests,
305 template <
typename Shape,
typename NarrowPhaseSolver>
311 template <
typename Shape,
typename NarrowPhaseSolver>
315 *(this->model2), this->tf1, this->tf2, this->nsolver, this->request, *(this->result));
319 template <
typename Shape,
typename NarrowPhaseSolver>
325 template <
typename Shape,
typename NarrowPhaseSolver>
330 if(this->enable_statistics) this->num_bv_tests++;
332 return distance(this->tf1.linear(), this->tf1.translation(), this->model2_bv, this->model1->getBV(b1).bv);
336 template <
typename Shape,
typename NarrowPhaseSolver>
340 this->tf1, this->tf2, this->nsolver, this->enable_statistics, this->num_leaf_tests, this->request, *(this->result));
344 template <
typename Shape,
typename NarrowPhaseSolver>
350 template <
typename Shape,
typename NarrowPhaseSolver>
354 *(this->model2), this->tf1, this->tf2, this->nsolver, this->request, *(this->result));
358 template <
typename Shape,
typename NarrowPhaseSolver>
365 template <
typename Shape,
typename NarrowPhaseSolver>
372 if(this->enable_statistics) this->num_bv_tests++;
374 return distance(this->tf1.linear(), this->tf1.translation(), this->model2_bv, this->model1->getBV(b1).bv);
378 template <
typename Shape,
typename NarrowPhaseSolver>
382 this->tf1, this->tf2, this->nsolver, this->enable_statistics, this->num_leaf_tests, this->request, *(this->result));
385 template <
typename BV,
typename Shape,
typename NarrowPhaseSolver,
template <
typename,
typename>
class OrientedNode>
389 const NarrowPhaseSolver* nsolver,
396 node.request = request;
397 node.result = &result;
399 node.model1 = &model1;
401 node.model2 = &model2;
403 node.nsolver = nsolver;
414 template <
typename Shape,
typename NarrowPhaseSolver>
419 const NarrowPhaseSolver* nsolver,
427 template <
typename Shape,
typename NarrowPhaseSolver>
432 const NarrowPhaseSolver* nsolver,
440 template <
typename Shape,
typename NarrowPhaseSolver>
445 const NarrowPhaseSolver* nsolver,