65 const fcl::Vec3f& center1 = tf1.getTranslation();
66 const fcl::Vec3f& center2 = tf2.getTranslation();
72 result.b1 = result.b2 = -1;
73 Vec3f c1c2 = center2 - center1;
76 if (dist > epsilon) unit = c1c2 / dist;
78 penetrationDepth = r1 + r2 - dist;
80 result.min_distance = -penetrationDepth;
84 FCL_REAL abscissa = .5 * r1 + .5 * (dist - r2);
85 Vec3f contact = center1 + abscissa * unit;
86 result.nearest_points[0] = result.nearest_points[1] = contact;
87 return result.min_distance;
90 result.nearest_points[0] = center1 + abs1 * unit;
91 result.nearest_points[1] = center1 + abs2 * unit;
93 return result.min_distance;
111 Vec3f c1c2 = center2 - center1;
114 if (dist > epsilon) unit = c1c2 / dist;
116 FCL_REAL distToCollision = dist - (r1 + r2 + margin);
120 center2 - unit * r2);
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));
request to the distance computation
void addContact(const Contact &c)
add one contact into result structure
request to the collision algorithm
FCL_REAL collision_distance_threshold
threshold below which a collision is considered.
void updateDistanceLowerBoundFromLeaf(const CollisionRequest &, CollisionResult &res, const FCL_REAL &distance, const Vec3f &p0, const Vec3f &p1)
FCL_REAL radius
Radius of the sphere.
Center at zero point sphere.
collision and distance solver based on GJK algorithm implemented in fcl (rewritten the code from the ...
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
The geometry for the object for collision or distance computation.
FCL_REAL ShapeShapeDistance< Sphere, Sphere >(const CollisionGeometry *o1, const Transform3f &tf1, const CollisionGeometry *o2, const Transform3f &tf2, const GJKSolver *, const DistanceRequest &, DistanceResult &result)
FCL_REAL security_margin
Distance below which objects are considered in collision. See Collision.