36 for (
int32 i = 0; i < count1; ++i)
44 for (
int32 j = 0; j < count2; ++j)
53 if (si > maxSeparation)
60 *edgeIndex = bestIndex;
74 b2Assert(0 <= edge1 && edge1 < poly1->m_count);
82 for (
int32 i = 0; i < count2; ++i)
94 int32 i2 = i1 + 1 < count2 ? i1 + 1 : 0;
96 c[0].
v =
b2Mul(xf2, vertices2[i1]);
102 c[1].
v =
b2Mul(xf2, vertices2[i2]);
125 if (separationA > totalRadius)
130 if (separationB > totalRadius)
140 if (separationB > separationA + k_tol)
168 int32 iv2 = edge1 + 1 < count1 ? edge1 + 1 : 0;
170 b2Vec2 v11 = vertices1[iv1];
171 b2Vec2 v12 = vertices1[iv2];
173 b2Vec2 localTangent = v12 - v11;
177 b2Vec2 planePoint = 0.5f * (v11 + v12);
182 v11 =
b2Mul(xf1, v11);
183 v12 =
b2Mul(xf1, v12);
189 float32 sideOffset1 = -
b2Dot(tangent, v11) + totalRadius;
190 float32 sideOffset2 =
b2Dot(tangent, v12) + totalRadius;
215 int32 pointCount = 0;
218 float32 separation =
b2Dot(normal, clipPoints2[i].v) - frontOffset;
220 if (separation <= totalRadius)
224 cp->
id = clipPoints2[i].
id;
float32 b2Dot(const b2Vec2 &a, const b2Vec2 &b)
Perform the dot product on two vectors.
void b2CollidePolygons(b2Manifold *manifold, const b2PolygonShape *polyA, const b2Transform &xfA, const b2PolygonShape *polyB, const b2Transform &xfB)
Compute the collision manifold between two polygons.
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
Used for computing contact manifolds.
b2Vec2 localNormal
not use for Type::e_points
static void b2FindIncidentEdge(b2ClipVertex c[2], const b2PolygonShape *poly1, const b2Transform &xf1, int32 edge1, const b2PolygonShape *poly2, const b2Transform &xf2)
b2ContactID id
uniquely identifies a contact point between two shapes
#define b2_maxManifoldPoints
float32 b2Cross(const b2Vec2 &a, const b2Vec2 &b)
Perform the cross product on two vectors. In 2D this produces a scalar.
b2Vec2 m_vertices[b2_maxPolygonVertices]
int32 pointCount
the number of manifold points
b2Vec2 localPoint
usage depends on manifold type
b2Vec2 b2MulT(const b2Mat22 &A, const b2Vec2 &v)
TFSIMD_FORCE_INLINE tfScalar dot(const Quaternion &q1, const Quaternion &q2)
b2Vec2 localPoint
usage depends on manifold type
b2ManifoldPoint points[b2_maxManifoldPoints]
the points of contact
int32 b2ClipSegmentToLine(b2ClipVertex vOut[2], const b2ClipVertex vIn[2], const b2Vec2 &normal, float32 offset, int32 vertexIndexA)
Clipping for contact manifolds.
static float32 b2FindMaxSeparation(int32 *edgeIndex, const b2PolygonShape *poly1, const b2Transform &xf1, const b2PolygonShape *poly2, const b2Transform &xf2)
float32 Normalize()
Convert this vector into a unit vector. Returns the length.
b2Vec2 m_normals[b2_maxPolygonVertices]