38 float distSqr =
b2Dot(d, d);
40 float radius = rA + rB;
41 if (distSqr > radius * radius)
67 int32 normalIndex = 0;
74 for (
int32 i = 0; i < vertexCount; ++i)
76 float s =
b2Dot(normals[i], cLocal - vertices[i]);
92 int32 vertIndex1 = normalIndex;
93 int32 vertIndex2 = vertIndex1 + 1 < vertexCount ? vertIndex1 + 1 : 0;
94 b2Vec2 v1 = vertices[vertIndex1];
95 b2Vec2 v2 = vertices[vertIndex2];
110 float u1 =
b2Dot(cLocal - v1, v2 - v1);
111 float u2 =
b2Dot(cLocal - v2, v1 - v2);
144 b2Vec2 faceCenter = 0.5f * (v1 + v2);
145 float s =
b2Dot(cLocal - faceCenter, normals[vertIndex1]);
void b2CollidePolygonAndCircle(b2Manifold *manifold, const b2PolygonShape *polygonA, const b2Transform &xfA, const b2CircleShape *circleB, const b2Transform &xfB)
Compute the collision manifold between a polygon and a circle.
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
float b2Dot(const b2Vec2 &a, const b2Vec2 &b)
Perform the dot product on two vectors.
b2Vec2 localNormal
not use for Type::e_points
b2ContactID id
uniquely identifies a contact point between two shapes
void SetZero()
Set this vector to all zeros.
float b2DistanceSquared(const b2Vec2 &a, const b2Vec2 &b)
b2Vec2 m_vertices[b2_maxPolygonVertices]
int32 pointCount
the number of manifold points
b2Vec2 localPoint
usage depends on manifold type
b2Vec2 localPoint
usage depends on manifold type
b2ManifoldPoint points[b2_maxManifoldPoints]
the points of contact
b2Vec2 b2MulT(const b2Mat22 &A, const b2Vec2 &v)
float Normalize()
Convert this vector into a unit vector. Returns the length.
void b2CollideCircles(b2Manifold *manifold, const b2CircleShape *circleA, const b2Transform &xfA, const b2CircleShape *circleB, const b2Transform &xfB)
Compute the collision manifold between two circles.
b2Vec2 m_normals[b2_maxPolygonVertices]