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

Summary

Actions Summary Table

ActionsDescription
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 origin.
GetCount()This action returns the number of vertices is in this simplex.
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 origin.
GetVertices()This action gets all of the vertices of the current simplex as an array.
GetWitnessPoints(Libraries.Compute.Vector2 pointA, Libraries.Compute.Vector2 pointB)This action finds the "pointA" and "pointB" variables of the DistanceOutput2D class.
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 object.
SetCount(integer count)This action sets the number of vertices in this simplex.
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.

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 (smaller)

Parameters

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(t)

Parameters

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

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 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)

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

Parameters

SetCount(integer count)

This action sets the number of vertices in this simplex.

Parameters

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