17 #ifndef AGXCOLLIDE_BASICINTERSECTIONCODE_H
18 #define AGXCOLLIDE_BASICINTERSECTIONCODE_H
30 namespace agxCollide {
31 class ClosestPointsSolution;
36 namespace ShapeColliders {
160 const ClosestPointsSolution& closest,
173 bool createOnlyForCyl1InCyl2 =
false);
193 const agx::Vec3 p1 = cap1 * capsuleTransform;
194 const agx::Vec3 p2 = cap2 * capsuleTransform;
201 if (d1 <= capsuleRadius) {
203 const agx::Real depth = capsuleRadius - d1;
205 ShapeCollider::addContactPoint( result, point, normal * normalFlipSign, depth );
209 if (d2 <= capsuleRadius) {
211 const agx::Real depth = capsuleRadius - d2;
213 ShapeCollider::addContactPoint( result, point, normal * normalFlipSign, depth );
226 const agx::Real radiusSum = radius1 + radius2;
227 agx::Vec3 normal = position1 - position2;
230 if (radiusSum * radiusSum < len2) {
234 if ((radiusSum + epsilon) * (radiusSum + epsilon) < len2)
240 ShapeCollider::addContactPoint( result,
241 position2 + normal * radius2, normal,
agx::Real(0) );
256 const agx::Real depth = radiusSum - distance;
258 ShapeCollider::addContactPoint( result,
259 position2 + normal * (radius2 - depth *
agx::Real(0.5)),
273 if (distance > sphereRadius)
276 const agx::Real depth = sphereRadius - distance;
277 ShapeCollider::addContactPoint( result, spherePosition +
278 normal * (depth *
agx::Real(0.5) - sphereRadius), normal, depth );
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
AGXCORE_EXPORT const Real RealEpsilon
#define AGXPHYSICS_EXPORT
Real length2() const
Length squared of the vector = vec .
Class representing the mathematical concept of a plane, also called a half- space.
Real normalize()
Normalize the vector so that it has length unity.
agx::Vec3T< T > getNormal() const
/return The normal of the plane.
T signedDistanceToPoint(const agx::Vec3T< T > &point) const
Calculates the distance from the plane to a point.
#define DOXYGEN_END_INTERNAL_BLOCK()
agx::VectorPOD< LocalContactPoint > LocalContactPointVector
#define DOXYGEN_START_INTERNAL_BLOCK()