38 #ifndef FCL_CCD_TRIANGLEMOTIONBOUNDVISITOR_INL_H 39 #define FCL_CCD_TRIANGLEMOTIONBOUNDVISITOR_INL_H 41 #include "fcl/math/motion/triangle_motion_bound_visitor.h" 43 #include "fcl/math/motion/spline_motion.h" 44 #include "fcl/math/motion/screw_motion.h" 45 #include "fcl/math/motion/interp_motion.h" 46 #include "fcl/math/motion/translation_motion.h" 47 #include "fcl/math/motion/triangle_motion_bound_visitor.h" 54 class TriangleMotionBoundVisitor<double>;
58 TriangleMotionBoundVisitor<S>::TriangleMotionBoundVisitor(
59 const Vector3<S>& a_,
const Vector3<S>& b_,
60 const Vector3<S>& c_,
const Vector3<S>& n_)
61 : a(a_), b(b_), c(c_), n(n_)
67 template <
typename S,
typename MotionT>
119 template <
typename S>
129 const Vector3<S>& axis = motion.getAxis();
130 S linear_vel = motion.getLinearVelocity();
131 S angular_vel = motion.getAngularVelocity();
132 const Vector3<S>& p = motion.getAxisOrigin();
134 S proj_max = ((tf.linear() * visitor.a + tf.translation() - p).cross(axis)).squaredNorm();
136 tmp = ((tf.linear() * visitor.b + tf.translation() - p).cross(axis)).squaredNorm();
137 if(tmp > proj_max) proj_max = tmp;
138 tmp = ((tf.linear() * visitor.c + tf.translation() - p).cross(axis)).squaredNorm();
139 if(tmp > proj_max) proj_max = tmp;
141 proj_max = std::sqrt(proj_max);
143 S v_dot_n = axis.dot(visitor.n) * linear_vel;
144 S w_cross_n = (axis.cross(visitor.n)).norm() * angular_vel;
145 S mu = v_dot_n + w_cross_n * proj_max;
156 template <
typename S>
166 const Vector3<S>& reference_p = motion.getReferencePoint();
167 const Vector3<S>& angular_axis = motion.getAngularAxis();
168 S angular_vel = motion.getAngularVelocity();
169 const Vector3<S>& linear_vel = motion.getLinearVelocity();
171 S proj_max = ((tf.linear() * (visitor.a - reference_p)).cross(angular_axis)).squaredNorm();
173 tmp = ((tf.linear() * (visitor.b - reference_p)).cross(angular_axis)).squaredNorm();
174 if(tmp > proj_max) proj_max = tmp;
175 tmp = ((tf.linear() * (visitor.c - reference_p)).cross(angular_axis)).squaredNorm();
176 if(tmp > proj_max) proj_max = tmp;
178 proj_max = std::sqrt(proj_max);
180 S v_dot_n = linear_vel.dot(visitor.n);
181 S w_cross_n = (angular_axis.cross(visitor.n)).norm() * angular_vel;
182 S mu = v_dot_n + w_cross_n * proj_max;
189 template <
typename S>
196 S T_bound = motion.computeTBound(visitor.n);
197 S tf_t = motion.getCurrentTime();
199 S R_bound = std::abs(visitor.a.dot(visitor.n)) + visitor.a.norm() + (visitor.a.cross(visitor.n)).norm();
200 S R_bound_tmp = std::abs(visitor.b.dot(visitor.n)) + visitor.b.norm() + (visitor.b.cross(visitor.n)).norm();
201 if(R_bound_tmp > R_bound) R_bound = R_bound_tmp;
202 R_bound_tmp = std::abs(visitor.c.dot(visitor.n)) + visitor.c.norm() + (visitor.c.cross(visitor.n)).norm();
203 if(R_bound_tmp > R_bound) R_bound = R_bound_tmp;
205 S dWdW_max = motion.computeDWMax();
206 S ratio = std::min(1 - tf_t, dWdW_max);
208 R_bound *= 2 * ratio;
212 return R_bound + T_bound;
218 template <
typename S>
225 return motion.getVelocity().dot(visitor.n);
Definition: motion_base.h:52
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
Definition: bv_motion_bound_visitor.h:51
void getCurrentTransform(Transform3< S > &tf_) const
Get the rotation and translation in current step.
Definition: interp_motion-inl.h:156
Definition: bv_motion_bound_visitor.h:57
void getCurrentTransform(Transform3< S > &tf_) const
Get the rotation and translation in current step.
Definition: screw_motion-inl.h:125
Definition: bv_motion_bound_visitor.h:48
Linear interpolation motion Each Motion is assumed to have constant linear velocity and angular veloc...
Definition: bv_motion_bound_visitor.h:54
Definition: triangle_motion_bound_visitor-inl.h:68