Appearance
Class: Manifold
A manifold for two touching convex shapes. Manifolds are created in evaluate method of Contact subclasses.
Supported manifold types are e_faceA or e_faceB for clip point versus plane with radius and e_circles point versus point with radius.
We store contacts in this way so that position correction can account for movement, which is critical for continuous physics. All contact scenarios must be expressed in one of these types. This structure is stored across time steps, so we keep it small.
Constructors
Constructor
new Manifold():
Manifold
Returns
Manifold
Properties
localNormal
localNormal:
Vec2Value
Usage depends on manifold type:
- circles: not used
- faceA: the normal on polygonA
- faceB: the normal on polygonB
localPoint
localPoint:
Vec2Value
Usage depends on manifold type:
- circles: the local center of circleA
- faceA: the center of faceA
- faceB: the center of faceB
pointCount
pointCount:
number=0
The number of manifold points
points
points:
ManifoldPoint[]
The points of contact
type
type:
ManifoldType
clipSegmentToLine()
staticclipSegmentToLine: (vOut,vIn,normal,offset,vertexIndexA) =>number
Clips the segment vIn against the half-plane normal.v <= offset, into vOut, and returns the point count.
Contact ids follow one convention, written as if the reference face were on shape A (the collider swaps them afterwards when it is on B): a point that is an incident vertex k lying on the reference face f carries (f, e_face, k, e_vertex), and a point produced here, the incident edge cut by the side plane at reference vertex j, carries (j, e_vertex, edge, e_face). The two kinds differ in their feature types and two points of one kind differ in their index, so the points of a manifold never share an id; Contact.update relies on that to carry warm-start impulses to the right point.
Parameters
vOut
vIn
normal
offset
number
vertexIndexA
number
the reference vertex whose side plane this is
Returns
number
ClipVertex
staticClipVertex: typeofClipVertex
getPointStates()
staticgetPointStates: (state1,state2,manifold1,manifold2) =>void
Compute the point states given two manifolds. The states pertain to the transition from manifold1 to manifold2. So state1 is either persist or remove while state2 is either add or persist.
Parameters
state1
state2
manifold1
Manifold
manifold2
Manifold
Returns
void
PointState
staticPointState: typeofPointState
Methods
getWorldManifold()
getWorldManifold(
wm,xfA,radiusA,xfB,radiusB):WorldManifold
Evaluate the manifold with supplied transforms. This assumes modest motion from the original state. This does not change the point count, impulses, etc. The radii must come from the shapes that generated the manifold.
Parameters
wm
xfA
radiusA
number
xfB
radiusB
number
Returns
recycle()
recycle():
void
Returns
void
set()
set(
that):void
Parameters
that
Manifold
Returns
void