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 on.

Inherits from: Libraries.Language.Object

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.

Parameters

Return

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

Example

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

Equals(Libraries.Language.Object object)

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

Parameters

Return

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

Example

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

GetClosestPoint(Libraries.Compute.Vector2 point)

This action finds the closest point on the Minkowski difference to the origin.

Parameters

GetCount()

This action returns the number of vertices is in this simplex.

Return

integer:

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

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 triangle.

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 origin.

Parameters

GetVertices()

This action gets all of the vertices of the current simplex as an array.

Return

Libraries.Containers.Array:

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

This action finds the "pointA" and "pointB" variables of the DistanceOutput2D class.

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)

SetCount(integer count)

This action sets the number of vertices in this simplex.

Parameters

  • integer count

Solve2()

This action finds the closest point on an edge to the origin.

Solve3()

This action finds the closest point on a triangle to the origin.

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 object.

Parameters