37 #ifndef FCL_NARROWPHASE_DETAIL_SPHEREBOX_INL_H 38 #define FCL_NARROWPHASE_DETAIL_SPHEREBOX_INL_H 45 extern template FCL_EXPORT
bool 47 const Box<double>& box,
const Transform3<double>& X_FB,
48 std::vector<ContactPoint<double>>* contacts);
52 extern template FCL_EXPORT
bool 54 const Box<double>& box,
const Transform3<double>& X_FB,
55 double*
distance, Vector3<double>* p_FSb,
56 Vector3<double>* p_FBs);
75 assert(p_BN_ptr !=
nullptr);
82 for (
int i = 0; i < 3; ++i) {
116 S squared_distance = p_CN_B.squaredNorm();
119 if (squared_distance > r * r)
124 if (contacts !=
nullptr) {
139 if (N_is_not_C && squared_distance > eps * eps) {
143 S
distance = sqrt(squared_distance);
146 p_BP = p_BN + n_SB_B * (depth * 0.5);
155 std::numeric_limits<typename constants<S>::Real>::infinity();
157 for (
int i = 0; i < 3; ++i) {
160 if (dist + eps < min_distance) {
171 n_SB_B(min_axis) = p_BC(min_axis) >= 0 ? -1 : 1;
172 depth = min_distance +
r;
173 p_BP = p_BC + n_SB_B * ((r - min_distance) / 2);
175 contacts->emplace_back(X_FB.linear() * n_SB_B, X_FB * p_BP, depth);
182 template <
typename S>
204 S squared_distance = p_NC_B.squaredNorm();
205 if (squared_distance > r * r) {
209 if (distance || p_FBs || p_FSb)
210 d = sqrt(squared_distance);
211 if (distance !=
nullptr)
213 if (p_FBs !=
nullptr)
214 *p_FBs = X_FB * p_BN;
215 if (p_FSb !=
nullptr) {
216 const Vector3<S> p_BSb = (p_NC_B / d) * (d - r) + p_BN;
217 *p_FSb = X_FB * p_BSb;
224 if (distance !=
nullptr) *distance = -1;
231 #endif // FCL_NARROWPHASE_DETAIL_SPHEREBOX_INL_H
Eigen::Transform< S, 3, Eigen::Isometry > Transform3
static constexpr Real eps()
Returns ε for the precision of the underlying scalar type.
Eigen::Matrix< S, 3, 1 > Vector3
template FCL_EXPORT bool sphereBoxIntersect(const Sphere< double > &sphere, const Transform3< double > &X_FS, const Box< double > &box, const Transform3< double > &X_FB, std::vector< ContactPoint< double >> *contacts)
Center at zero point, axis aligned box.
template void distance(DistanceTraversalNodeBase< double > *node, BVHFrontList *front_list, int qsize)
Vector3< S > side
box side length
bool nearestPointInBox(const Vector3< S > &size, const Vector3< S > &p_BQ, Vector3< S > *p_BN_ptr)
S radius
Radius of the sphere.
Center at zero point sphere.
template class FCL_EXPORT Box< double >
template class FCL_EXPORT Sphere< double >
template FCL_EXPORT bool sphereBoxDistance(const Sphere< double > &sphere, const Transform3< double > &X_FS, const Box< double > &box, const Transform3< double > &X_FB, double *distance, Vector3< double > *p_FSb, Vector3< double > *p_FBs)