Skip to main content

Class: ManifoldMap

physics/manifoldMap.ManifoldMap

Represents a 2 layered {@link Map} containing Manifolds for CollisionObject pairs.

Constructors

constructor

โ€ข new ManifoldMap()

Properties

map

โ€ข map: Map<CollisionObject, Map<CollisionObject, Manifold>>

Defined in

src/physics/manifoldMap.ts:9

Methods

addManifold

โ–ธ addManifold(a, b, m): void

Adds a manifold to the map with the top level key being a and inner key being b.

If a manifold is already in the map with key [b, a] then that manifold will be updated instead.

Parameters

NameTypeDescription
aCollisionObjectThe first object for the key
bCollisionObjectThe second object for the key
mManifoldThe manifold to insert

Returns

void

Defined in

src/physics/manifoldMap.ts:79


getAllManifolds

โ–ธ getAllManifolds(): Manifold[]

Gets all the manifolds in the map and returns them as a contiguous array.

Returns

Manifold[]

All the manifolds in the map as an array

Defined in

src/physics/manifoldMap.ts:16


getManifold

โ–ธ getManifold(a, b): Manifold

Finds a manifold in the ManifoldMap.

Parameters

NameTypeDescription
aCollisionObjectThe first collision object
bCollisionObjectThe second collision object

Returns

Manifold

The manifold for the collision between a and b or undefined.

Defined in

src/physics/manifoldMap.ts:34


getManifoldKey

โ–ธ getManifoldKey(a, b): Object

Finds the correct key in the map for objects a and b.

Parameters

NameTypeDescription
aCollisionObjectAn object in the key
bCollisionObjectAn object in the key

Returns

Object

The manifold key or undefined

NameType
keyCollisionObject
topCollisionObject

Defined in

src/physics/manifoldMap.ts:54


killAllManifolds

โ–ธ killAllManifolds(): void

Sets isDead to true for every manifold in the map.

Returns

void

Defined in

src/physics/manifoldMap.ts:156


removeDeadManifolds

โ–ธ removeDeadManifolds(): void

Removes all manifolds in the map which have isDead set to true.

Returns

void

Defined in

src/physics/manifoldMap.ts:141


removeManifold

โ–ธ removeManifold(a, b): boolean

Removes the manifold involving objects a and b.

Parameters

NameTypeDescription
aCollisionObjectAn object in the manifold
bCollisionObjectAnother object in the manifold

Returns

boolean

Wether or not a manifold was removed

Defined in

src/physics/manifoldMap.ts:116


removeManifoldsInvolving

โ–ธ removeManifoldsInvolving(obj): void

Removes all manifolds involving the given object.

Parameters

NameTypeDescription
objCollisionObjectThe obj to remove manifolds of

Returns

void

Defined in

src/physics/manifoldMap.ts:131