Table of Contents

Struct SimplexSolver

Namespace
Jitter2.Collision
Assembly
Jitter2.dll

Implements the Gilbert-Johnson-Keerthi (GJK) simplex solver for finding the closest point to the origin on a simplex (point, line segment, triangle, or tetrahedron).

public struct SimplexSolver
Inherited Members

Remarks

This solver iteratively reduces the simplex to the feature closest to the origin. It handles degeneracy by falling back to lower-dimensional features when the current simplex is near-degenerate.

Complexity: O(1) per vertex addition for point/segment, O(1) for triangle, O(1) for tetrahedron with early-out optimizations.

Methods

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 to add (a point on the Minkowski difference).

closest JVector

When this method returns, contains the point on the reduced simplex closest to the origin.

Returns

bool

true if the origin is not contained within the simplex (continue iterating); false if the origin is enclosed by the tetrahedron (collision detected).

Reset()

Resets the solver to an empty simplex.

public void Reset()