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) {
210 d = sqrt(squared_distance);
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;
231 #endif // FCL_NARROWPHASE_DETAIL_SPHEREBOX_INL_H