Table of Contents

Struct ConvexPolytope

Namespace
Jitter2.Collision
Assembly
Jitter2.dll

EPA polytope with filtered exact visibility, orientation and degeneracy predicates on the supplied floating-point coordinates.

public struct ConvexPolytope
Inherited Members

Remarks

Distances, barycentric coordinates and contact outputs remain approximate and are evaluated in double precision. Managed storage is allocated by InitHeap() and reused. Instances must not be shared between threads. Each nonzero Minkowski vertex coordinate must have magnitude between 2^-200 and 2^200, inclusive. Seeds and expansions outside this range are rejected.

Properties

HullTriangles

public readonly Span<ConvexPolytope.Triangle> HullTriangles { get; }

Property Value

Span<ConvexPolytope.Triangle>

OriginEnclosed

Indicates whether the origin is enclosed. Updated by GetClosestTriangle().

public readonly bool OriginEnclosed { get; }

Property Value

bool

Methods

AddVertex(in Vertex)

Adds a vertex. Use AddVertexDetailed(in Vertex) to distinguish a clean stop from a failure.

public bool AddVertex(in MinkowskiDifference.Vertex vertex)

Parameters

vertex MinkowskiDifference.Vertex

Returns

bool

Remarks

Successful expansion invalidates previous triangle references. NoHorizon preserves the hull; any other failure requires reinitialization before the hull can be used again.

AddVertexDetailed(in Vertex)

Expands the hull in place. NoHorizon is a clean lack of expansion and leaves the active hull unchanged. Any other failure requires reinitialization.

public ConvexPolytope.AddVertexResult AddVertexDetailed(in MinkowskiDifference.Vertex vertex)

Parameters

vertex MinkowskiDifference.Vertex

Returns

ConvexPolytope.AddVertexResult

CalculatePoints(in Triangle, out JVector, out JVector)

Calculates shape contact points from a triangle still belonging to the current hull.

public void CalculatePoints(in ConvexPolytope.Triangle triangle, out JVector pointA, out JVector pointB)

Parameters

triangle ConvexPolytope.Triangle
pointA JVector
pointB JVector

GetClosestTriangle()

Finds the closest triangle using double-precision distances and updates origin enclosure.

public ref ConvexPolytope.Triangle GetClosestTriangle()

Returns

ConvexPolytope.Triangle

GetVertex(int)

public ref MinkowskiDifference.Vertex GetVertex(int index)

Parameters

index int

Returns

MinkowskiDifference.Vertex

InitHeap()

Allocates reusable managed buffers once. Call before setting vertices or initializing the hull.

public void InitHeap()

InitTetrahedron()

Initializes from the first four vertices. False indicates an invalid or unsupported seed.

public bool InitTetrahedron()

Returns

bool

InitTetrahedron(in JVector)

Initializes a small tetrahedron centered at the specified point.

public bool InitTetrahedron(in JVector point)

Parameters

point JVector

Returns

bool

False if the seed is degenerate, unsupported, or cannot be evaluated.