Table of Contents

Struct SimplexSolverAB

Namespace
Jitter2.Collision
Assembly
Jitter2.dll

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

vertex MinkowskiDifference.Vertex

The Minkowski difference vertex including support points from both shapes.

closest JVector

The point on the reduced simplex closest to the origin.

Returns

bool

true if the origin is not contained within the simplex; false if 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

vertex JVector

The vertex position on the Minkowski difference.

closest JVector

The point on the reduced simplex closest to the origin.

Returns

bool

true if the origin is not contained within the simplex; false if 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

pointA JVector

The closest point on shape A.

pointB JVector

The closest point on shape B.

Reset()

Resets the solver to an empty simplex.

public void Reset()