## Libraries.Game.Collision.Narrowphase.Simplex2D Documentation

This class records a point (count = 1), a line (count = 2), or a triangle (count = 3), which are all simplexes. This class is used internally by the class Distance2D to store the current simplex that the GJK algorithm is focusing o

*Inherits from: *Libraries.Language.Object

## Summary

### Actions Summary Table

Actions | Description |
---|---|

Compare(Libraries.Language.Object object) | This action compares two object hash codes and returns an integer. |

Equals(Libraries.Language.Object object) | This action determines if two objects are equal based on their hash code values. |

GetClosestPoint(Libraries.Compute.Vector2 point) | This action finds the closest point on the Minkowski difference to the origi |

GetCount() | This action returns the number of vertices is in this simple |

GetHashCode() | This action gets the hash code for an object. |

GetMetric() | This action finds the denominator to normalize the barycentric coordinates with. |

GetSearchDirection(Libraries.Compute.Vector2 direction) | This action finds the direction to look for a simplex vertex to be added to find the closest point between the Minkowski difference of shape A and B and the origi |

GetVertices() | This action gets all of the vertices of the current simplex as an arra |

GetWitnessPoints(Libraries.Compute.Vector2 pointA, Libraries.Compute.Vector2 pointB) | This action finds the "pointA" and "pointB" variables of the DistanceOutput2D clas |

ReadCache(Libraries.Game.Collision.Narrowphase.SimplexCache2D cache, Libraries.Game.Collision.Narrowphase.DistanceProxy2D distanceA, Libraries.Game.Collision.PhysicsPosition2D transformA, Libraries.Game.Collision.Narrowphase.DistanceProxy2D distanceB, Libraries.Game.Collision.PhysicsPosition2D transformB) | This action load the Simplex2D that was calculated at the end of the previous iteration of GJK algorithm from the SimplexCache2D objec |

SetCount(integer count) | This action sets the number of vertices in this simple |

Solve2() | This action finds the closest point on an edge to the origi |

Solve3() | This action finds the closest point on a triangle to the origi |

WriteCache(Libraries.Game.Collision.Narrowphase.SimplexCache2D cache) | When an interation of the GJK distance calculation is done, the Simplex2D used to calculate the distance is updated. |

## Actions Documentation

### Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

**Example Code**

```
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smalle
```

#### Parameters

- Libraries.Language.Object: The object to compare to.

#### Return

integer: The Compare result, Smaller, Equal, or Larger.

### Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

**Example Code**

```
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(
```

#### Parameters

- Libraries.Language.Object: The to be compared.

#### Return

boolean: True if the hash codes are equal and false if they are not equal.

### GetClosestPoint(Libraries.Compute.Vector2 point)

This action finds the closest point on the Minkowski difference to the origi

#### Parameters

### GetCount()

This action returns the number of vertices is in this simple

#### Return

integer:

### GetHashCode()

This action gets the hash code for an object.

**Example Code**

```
Object o
integer hash = o:GetHashCode
```

#### Return

integer: The integer hash code of the object.

### GetMetric()

This action finds the denominator to normalize the barycentric coordinates with. For a point, don't need to normalize. For a line, the barycentric coordinates are normalized by the length of the line. For a triangle, the barycentric coordinates are normalized by the area of the triangl

#### Return

number:

### GetSearchDirection(Libraries.Compute.Vector2 direction)

This action finds the direction to look for a simplex vertex to be added to find the closest point between the Minkowski difference of shape A and B and the origi

#### Parameters

### GetVertices()

This action gets all of the vertices of the current simplex as an arra

#### Return

### GetWitnessPoints(Libraries.Compute.Vector2 pointA, Libraries.Compute.Vector2 pointB)

This action finds the "pointA" and "pointB" variables of the DistanceOutput2D clas

#### Parameters

### ReadCache(Libraries.Game.Collision.Narrowphase.SimplexCache2D cache, Libraries.Game.Collision.Narrowphase.DistanceProxy2D distanceA, Libraries.Game.Collision.PhysicsPosition2D transformA, Libraries.Game.Collision.Narrowphase.DistanceProxy2D distanceB, Libraries.Game.Collision.PhysicsPosition2D transformB)

This action load the Simplex2D that was calculated at the end of the previous iteration of GJK algorithm from the SimplexCache2D objec

#### Parameters

- Libraries.Game.Collision.Narrowphase.SimplexCache2D
- Libraries.Game.Collision.Narrowphase.DistanceProxy2D
- Libraries.Game.Collision.PhysicsPosition2D
- Libraries.Game.Collision.Narrowphase.DistanceProxy2D
- Libraries.Game.Collision.PhysicsPosition2D

### SetCount(integer count)

This action sets the number of vertices in this simple

#### Parameters

### Solve2()

This action finds the closest point on an edge to the origi

### Solve3()

This action finds the closest point on a triangle to the origi

### WriteCache(Libraries.Game.Collision.Narrowphase.SimplexCache2D cache)

When an interation of the GJK distance calculation is done, the Simplex2D used to calculate the distance is updated. This action temporarity stores the updated Simplex2D object into a SimplexCache2D objec