38 #ifndef FCL_TRAVERSAL_SHAPEMESHCONSERVATIVEADVANCEMENTTRAVERSALNODE_INL_H
39 #define FCL_TRAVERSAL_SHAPEMESHCONSERVATIVEADVANCEMENTTRAVERSALNODE_INL_H
52 template <
typename Shape,
typename BV,
typename NarrowPhaseSolver>
68 template <
typename Shape,
typename BV,
typename NarrowPhaseSolver>
73 if(this->enable_statistics) this->num_bv_tests++;
75 S d = this->model1_bv.distance(this->model2->getBV(b2).bv, &P1, &P2);
77 stack.emplace_back(P1, P2, b1, b2, d);
83 template <
typename Shape,
typename BV,
typename NarrowPhaseSolver>
88 if(this->enable_statistics) this->num_leaf_tests++;
90 const BVNode<BV>& node = this->model2->getBV(b2);
94 const Triangle& tri_id = this->tri_indices[primitive_id];
96 const Vector3<S>& p1 = this->vertices[tri_id[0]];
97 const Vector3<S>& p2 = this->vertices[tri_id[1]];
98 const Vector3<S>& p3 = this->vertices[tri_id[2]];
102 this->nsolver->shapeTriangleDistance(*(this->model1), this->tf1, p1, p2, p3, &d, &P1, &P2);
104 if(d < this->min_distance)
106 this->min_distance = d;
111 last_tri_id = primitive_id;
114 Vector3<S> n = P2 - this->tf1 * p1; n.normalize();
118 S bound1 = motion1->computeMotionBound(mb_visitor1);
119 S bound2 = motion2->computeMotionBound(mb_visitor2);
121 S bound = bound1 + bound2;
124 if(
bound <= d) cur_delta_t = 1;
125 else cur_delta_t = d /
bound;
127 if(cur_delta_t < delta_t)
128 delta_t = cur_delta_t;
132 template <
typename Shape,
typename BV,
typename NarrowPhaseSolver>
136 if((c >= w * (this->min_distance - this->abs_err)) && (c * (1 + this->rel_err) >= w * this->min_distance))
138 const auto& data = stack.back();
140 Vector3<S> n = data.P2 - this->tf1 * data.P1; n.normalize();
145 S bound1 = motion1->computeMotionBound(mb_visitor1);
146 S bound2 = motion2->computeMotionBound(mb_visitor2);
148 S bound = bound1 + bound2;
151 if(
bound < c) cur_delta_t = 1;
152 else cur_delta_t = c /
bound;
154 if(cur_delta_t < delta_t)
155 delta_t = cur_delta_t;
170 template <
typename Shape,
typename BV,
typename NarrowPhaseSolver>
177 const NarrowPhaseSolver* nsolver,
182 using S =
typename BV::S;
184 std::vector<Vector3<S>> vertices_transformed(model2.
num_vertices);
189 vertices_transformed[i] = new_v;
214 template <
typename Shape,
typename NarrowPhaseSolver>
215 ShapeMeshConservativeAdvancementTraversalNodeRSS<Shape, NarrowPhaseSolver>::
216 ShapeMeshConservativeAdvancementTraversalNodeRSS(
217 typename Shape::S w_)
219 Shape,
RSS<typename Shape::
S>, NarrowPhaseSolver>(w_)
225 template <
typename Shape,
typename NarrowPhaseSolver>
230 using S =
typename Shape::S;
232 if(this->enable_statistics) this->num_bv_tests++;
234 S d =
distance(this->tf2.linear(), this->tf2.translation(), this->model2->getBV(b2).bv, this->model1_bv, &P2, &P1);
236 this->stack.emplace_back(P1, P2, b1, b2, d);
242 template <
typename Shape,
typename NarrowPhaseSolver>
259 this->enable_statistics,
265 this->num_leaf_tests);
269 template <
typename Shape,
typename NarrowPhaseSolver>
289 template <
typename Shape,
typename NarrowPhaseSolver>
296 const NarrowPhaseSolver* nsolver,
299 using S =
typename Shape::S;
315 template <
typename Shape,
typename NarrowPhaseSolver>
318 typename Shape::S w_)
320 Shape,
OBBRSS<typename Shape::
S>, NarrowPhaseSolver>(w_)
325 template <
typename Shape,
typename NarrowPhaseSolver>
330 using S =
typename Shape::S;
332 if(this->enable_statistics) this->num_bv_tests++;
334 S d =
distance(this->tf2.linear(), this->tf2.translation(), this->model2->getBV(b2).bv, this->model1_bv, &P2, &P1);
336 this->stack.emplace_back(P1, P2, b1, b2, d);
342 template <
typename Shape,
typename NarrowPhaseSolver>
359 this->enable_statistics,
365 this->num_leaf_tests);
369 template <
typename Shape,
typename NarrowPhaseSolver>
389 template <
typename Shape,
typename NarrowPhaseSolver>
396 const NarrowPhaseSolver* nsolver,
399 using S =
typename Shape::S;