Struct SimplexSolverAB
Implements the Gilbert-Johnson-Keerthi (GJK) simplex solver with support for retrieving the closest points on the original shapes (A and B spaces).
public struct SimplexSolverAB
- Inherited Members
Remarks
Unlike SimplexSolver, this solver tracks barycentric coordinates and the original support points, enabling extraction of the closest points on each shape via GetClosest(out JVector, out JVector).
Complexity: O(1) per vertex addition with early-out optimizations.
Methods
AddVertex(in Vertex, out JVector)
Adds a vertex (with full A/B support point data) to the simplex and computes the new closest point to the origin.
public bool AddVertex(in MinkowskiDifference.Vertex vertex, out JVector closest)
Parameters
vertexMinkowskiDifference.VertexThe Minkowski difference vertex including support points from both shapes.
closestJVectorThe point on the reduced simplex closest to the origin.
Returns
- bool
trueif the origin is not contained within the simplex;falseif the origin is enclosed by the tetrahedron.
AddVertex(in JVector, out JVector)
Adds a vertex to the simplex and computes the new closest point to the origin.
public bool AddVertex(in JVector vertex, out JVector closest)
Parameters
vertexJVectorThe vertex position on the Minkowski difference.
closestJVectorThe point on the reduced simplex closest to the origin.
Returns
- bool
trueif the origin is not contained within the simplex;falseif the origin is enclosed by the tetrahedron.
GetClosest(out JVector, out JVector)
Computes the closest points on the original shapes A and B using the current simplex and barycentric coordinates.
public void GetClosest(out JVector pointA, out JVector pointB)
Parameters
Reset()
Resets the solver to an empty simplex.
public void Reset()