38 #ifndef FCL_NARROWPHASE_DETAIL_SPHERESPHERE_INL_H 39 #define FCL_NARROWPHASE_DETAIL_SPHERESPHERE_INL_H 41 #include "fcl/narrowphase/detail/primitive_shape_algorithm/sphere_sphere.h" 51 bool sphereSphereIntersect(
const Sphere<double>& s1,
const Transform3<double>& tf1,
52 const Sphere<double>& s2,
const Transform3<double>& tf2,
53 std::vector<ContactPoint<double>>* contacts);
57 bool sphereSphereDistance(
const Sphere<double>& s1,
const Transform3<double>& tf1,
58 const Sphere<double>& s2,
const Transform3<double>& tf2,
59 double* dist, Vector3<double>* p1, Vector3<double>* p2);
63 bool sphereSphereIntersect(
const Sphere<S>& s1,
const Transform3<S>& tf1,
64 const Sphere<S>& s2,
const Transform3<S>& tf2,
65 std::vector<ContactPoint<S>>* contacts)
67 Vector3<S> diff = tf2.translation() - tf1.translation();
69 if(len > s1.radius + s2.radius)
76 const Vector3<S> normal = len > 0 ? (diff / len).eval() : diff;
77 const Vector3<S>
point = tf1.translation() + diff * s1.radius / (s1.radius + s2.radius);
78 const S penetration_depth = s1.radius + s2.radius - len;
79 contacts->emplace_back(normal, point, penetration_depth);
87 bool sphereSphereDistance(
const Sphere<S>& s1,
const Transform3<S>& tf1,
88 const Sphere<S>& s2,
const Transform3<S>& tf2,
89 S* dist, Vector3<S>* p1, Vector3<S>* p2)
91 Vector3<S> o1 = tf1.translation();
92 Vector3<S> o2 = tf2.translation();
93 Vector3<S> diff = o1 - o2;
95 if(len > s1.radius + s2.radius)
97 if(dist) *dist = len - (s1.radius + s2.radius);
98 if(p1) *p1 = tf1.inverse(Eigen::Isometry) * (o1 - diff * (s1.radius / len));
99 if(p2) *p2 = tf2.inverse(Eigen::Isometry) * (o2 + diff * (s2.radius / len));
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
std::chrono::system_clock::time_point point
Representation of a point in time.
Definition: time.h:51