72 result.
b1 = result.
b2 = -1;
73 Vec3f c1c2 = center2 - center1;
76 if (dist >
epsilon) unit = c1c2 / dist;
78 penetrationDepth = r1 +
r2 - dist;
84 FCL_REAL abscissa = .5 * r1 + .5 * (dist -
r2);
85 Vec3f contact = center1 + abscissa * unit;
97 const CollisionGeometry* o1,
const Transform3f&
tf1,
98 const CollisionGeometry* o2,
const Transform3f&
tf2,
const GJKSolver*,
99 const CollisionRequest& request, CollisionResult& result) {
101 const Sphere* s1 =
static_cast<const Sphere*
>(o1);
102 const Sphere* s2 =
static_cast<const Sphere*
>(o2);
109 FCL_REAL margin = request.security_margin;
111 Vec3f c1c2 = center2 - center1;
114 if (dist >
epsilon) unit = c1c2 / dist;
116 FCL_REAL distToCollision = dist - (r1 +
r2 + margin);
120 center2 - unit * r2);
121 if (distToCollision <= request.collision_distance_threshold) {
124 FCL_REAL abscissa = .5 * r1 + .5 * (dist -
r2);
125 Vec3f contactPoint = center1 + abscissa * unit;
126 Contact contact(o1, o2, -1, -1, contactPoint, unit,
127 -(distToCollision + margin));
128 result.addContact(contact);