`Static`

`Readonly`

DISABLE_DISABLE_EDGE_EDGE : false = false

disables all edge/edge contacts and collisions.

`Static`

`Readonly`

DISABLE_DISABLE_MIDPOINT_VERTEX_CONTACT : true = true

true means don't generate contacts from midpoint Vertexes.

`Static`

`Readonly`

HIGHLIGHT_HIGHLIGHT_COLLISION_TESTING : false = false

highlight edges and Vertexes being tested for collisions or contacts

`Static`

edgeedgeEdgeCollisionTests : number = 0

number of times that an edge-edge collision test occurred

`Static`

specialspecialNormalHits : number = 0

Number of times that special normal was requested when it was already calculated.

`Static`

specialspecialNormalMisses : number = 0

Number of times that special normal was requested when it was not yet calculated.

`Static`

specialspecialNormalRotate : number = 0

Number of times the `specialNormal`

was rotated to world coords.

`Static`

vertexvertexBodyCollisionTests : number = 0

number of times that `testCollisionVertex`

was called.

`Static`

add- add
Collision (collisions, c2): boolean Adds the given collision only if it there is not already a deeper collision between the same bodies and same edges very close by. This helps prevent having duplicate collisions (or contacts), which helps the process of solving for contact forces or collision impulses with ComputeForces.

When a vertex collides into an edge, we need to see if there is a more accurate edge/edge collision to be used instead of the vertex/edge collision. For endpoint Vertexes, this involves testing both edges on either side of the vertex.

One way to look at this addCollision function is that you are defining an equality test between collisions, along with an ordering. A pair of collisions have to be approximately equal, and then we take the better of the two. If this were transitive, then you needn't worry about the case of 3 nearly equal collisions. Because you add collisions one at a time, you would always have only one of the 3 in the list at any time.

But collisions aren't really transitive because of the nearness criteria. Suppose there are 3 collisions, A, B, and C. A is near B, and B is near C. But A is not be 'near' C. As an example, suppose there are two 'decorated' midpoint Vertexes, A and C, on a curved edge. Suppose the distance between A and C is 0.11 and the nearness criteria is 0.1. So they are considered not near and both are added to the list. Now we add B, the edge/edge collision between A and C. It is near both A and C. To ensure that both A and C are removed, we need to go thru the entire list, allowing B to kick out every collision it is near to.

Even if the collision we are adding is rejected, we should still go thru the entire list. In the above example, again suppose that A and C are on the list but not near each other. But this time, A is the deepest collision, followed by B, with C being the shallowest. So

`A > B > C`

(where > means 'deeper'). We try to add B, but because`A > B`

, we reject B. If we stop there, then C will still be on the list. If we continue, we find that`B > C`

and also reject C. If we don't go thru the entire list this way, then the ordering of the list determines the final result: in one ordering of the list, C survives in another ordering it is rejected.Therefore, we always go thru the entire list, even when the collision we are considering has been shown to be shallower than a nearby collision. (Although this is probably very rare, and not devastating if it slipped through).

Joints are a special case, they should always be added, never removed.

#### Parameters

##### collisions: RigidBodyCollision[]

the list of collisions, to search and possibly add to

##### c2: RigidBodyCollision

the RigidBodyCollision to possibly add to the list

#### Returns boolean

true if the collision was added

`Static`

check- check
Vertexes (collisions, body1, body2, time): void Checks for collision of each vertex of body2 with edges of body1.

#### Parameters

##### collisions: RigidBodyCollision[]

the list of collisions to add to

##### body1: RigidBody

the RigidBody whose edges are checked

##### body2: RigidBody

the RigidBody whose Vertexes are checked

##### time: number

current simulation time

#### Returns void

`Static`

intersection- intersection
Possible (body1, body2, swellage): boolean Performs a rough proximity test: are the bodies close enough that their proximity circles overlap? Returns

`false`

when there can be no intersection between the two RigidBody bounding rectangles. Returns`true`

when an intersection between the two bodies is possible.Further checks are needed besides this rough check to determine if there really is intersection of the two bodies. The bounding rectangle can be increased in size by the

`swellage`

amount.#### Parameters

#### Returns boolean

false if there can be no intersection between the two bodies.

`Static`

intersection`Static`

`Private`

make- make
Collision (collisions, edge, vertex, e_body, p_body, time): void #### Parameters

##### collisions: RigidBodyCollision[]

the list of collisions to add to

##### edge: Edge

##### vertex: Vertex

##### e_body: Vector

##### p_body: Vector

##### time: number

current simulation time

#### Returns void

`Static`

print`Static`

subset- subset
Collisions1 (superset): RigidBodyCollision[] Returns a subset of collisions such that all the collisions in the set are are connected. Two collisions are connected when they have a common moveable (finite mass) body. The subset will be such that you can go from one collision to any other collision via neighboring connected collisions.

#### Parameters

##### superset: RigidBodyCollision[]

the set of collisions to examine

#### Returns RigidBodyCollision[]

a subset of collisions such that all the collisions in the set are connected by moveable bodies

`Static`

subset- subset
Collisions2 (superset, startC, hybrid, v, minVelocity): RigidBodyCollision[] Given a set of collisions and a starting collision in that set, returns the subset of collisions that are connected by joints to the moveable bodies in the starting collision. The subset will be such that you can go from one collision to any other collision via neighboring connected collisions.

#### Parameters

##### superset: RigidBodyCollision[]

the set of collisions to examine

##### startC: RigidBodyCollision

the starting collision in the superset

##### hybrid: boolean

include collisions involving either body in startC

##### v: number[]

array of velocity of each collision

##### minVelocity: number

for hybrid collision handling, only include collisions that have more negative velocity than this minimum.

#### Returns RigidBodyCollision[]

a subset of collisions such that all the collisions in the set are connected via joints to the moveable bodies of the starting collision.

`Static`

`Private`

test- test
Collision (collisions, body1, vertex2, v_body, v_body_old, travelDist, time): voidVertex Tests for collision or contact of a RigidBody with a Vertex. If a collision or contact is found, adds a new RigidBodyCollision to the list of collisions.

**TO DO**there may be opportunities to save computing time by calculating distance squared instead of distance, and selecting the proper distance from among those that got calculated (instead of recalculating the distance yet again when making the collision record).#### Parameters

##### collisions: RigidBodyCollision[]

the list of collisions to add to

##### body1: RigidBody

the RigidBody whose edges we are checking for collisions

##### vertex2: Vertex

the Vertex of body2

##### v_body: Vector

the current position of vertex2 in body coords of body1

##### v_body_old: Vector

the position of vertex2 at the last time step in body coords of body1, see Polygon.saveOldCoords

##### travelDist: number

the distance between v_body and v_body_old

##### time: number

current simulation time

#### Returns void

Generated using TypeDoc

Static class that provides utility methods for calculating collision information.