2021-04-16 17:10:15 +02:00
|
|
|
|
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Manifold](manifold.md)
|
|
|
|
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
|
|
|
|
**`prop`** type e_circle, e_faceA, e_faceB
|
|
|
|
|
|
|
|
|
|
|
|
**`prop`** localPoint Usage depends on manifold type:<br>
|
|
|
|
|
|
e_circles: the local center of circleA <br>
|
|
|
|
|
|
e_faceA: the center of faceA <br>
|
|
|
|
|
|
e_faceB: the center of faceB
|
|
|
|
|
|
|
|
|
|
|
|
**`prop`** localNormal Usage depends on manifold type:<br>
|
|
|
|
|
|
e_circles: not used <br>
|
|
|
|
|
|
e_faceA: the normal on polygonA <br>
|
|
|
|
|
|
e_faceB: the normal on polygonB
|
|
|
|
|
|
|
|
|
|
|
|
**`prop`** points The points of contact {ManifoldPoint[]}
|
|
|
|
|
|
|
|
|
|
|
|
**`prop`** pointCount The number of manifold points
|
|
|
|
|
|
|
|
|
|
|
|
## Hierarchy
|
|
|
|
|
|
|
|
|
|
|
|
* **Manifold**
|
|
|
|
|
|
|
|
|
|
|
|
## Index
|
|
|
|
|
|
|
|
|
|
|
|
### Properties
|
|
|
|
|
|
|
|
|
|
|
|
* [localNormal](manifold.md#localnormal)
|
|
|
|
|
|
* [localPoint](manifold.md#localpoint)
|
|
|
|
|
|
* [pointCount](manifold.md#pointcount)
|
|
|
|
|
|
* [points](manifold.md#points)
|
|
|
|
|
|
* [type](manifold.md#type)
|
|
|
|
|
|
|
|
|
|
|
|
### Methods
|
|
|
|
|
|
|
|
|
|
|
|
* [getWorldManifold](manifold.md#getworldmanifold)
|
|
|
|
|
|
|
|
|
|
|
|
## Properties
|
|
|
|
|
|
|
|
|
|
|
|
### localNormal
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **localNormal**: *[Vec2](vec2.md)* = Vec2.zero()
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/Manifold.ts:67](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L67)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### localPoint
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **localPoint**: *[Vec2](vec2.md)* = Vec2.zero()
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/Manifold.ts:68](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L68)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### pointCount
|
|
|
|
|
|
|
|
|
|
|
|
• **pointCount**: *number* = 0
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/Manifold.ts:70](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L70)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### points
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **points**: *[ManifoldPoint](manifoldpoint.md)[]* = [ new ManifoldPoint(), new ManifoldPoint() ]
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/Manifold.ts:69](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L69)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### type
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **type**: *[ManifoldType](../enums/manifoldtype.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/Manifold.ts:66](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L66)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
|
|
|
|
|
### getWorldManifold
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getWorldManifold**(`wm`: [WorldManifold](worldmanifold.md) | undefined, `xfA`: [Transform](transform.md), `radiusA`: number, `xfB`: [Transform](transform.md), `radiusB`: number): *[WorldManifold](worldmanifold.md)*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/Manifold.ts:77](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Manifold.ts#L77)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
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:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`wm` | [WorldManifold](worldmanifold.md) | undefined |
|
|
|
|
|
|
`xfA` | [Transform](transform.md) |
|
|
|
|
|
|
`radiusA` | number |
|
|
|
|
|
|
`xfB` | [Transform](transform.md) |
|
|
|
|
|
|
`radiusB` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *[WorldManifold](worldmanifold.md)*
|