Struct ConvexPolytope
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
OriginEnclosed
Indicates whether the origin is enclosed. Updated by GetClosestTriangle().
public readonly bool OriginEnclosed { get; }
Property Value
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
vertexMinkowskiDifference.Vertex
Returns
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
vertexMinkowskiDifference.Vertex
Returns
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
triangleConvexPolytope.TrianglepointAJVectorpointBJVector
GetClosestTriangle()
Finds the closest triangle using double-precision distances and updates origin enclosure.
public ref ConvexPolytope.Triangle GetClosestTriangle()
Returns
GetVertex(int)
public ref MinkowskiDifference.Vertex GetVertex(int index)
Parameters
indexint
Returns
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
InitTetrahedron(in JVector)
Initializes a small tetrahedron centered at the specified point.
public bool InitTetrahedron(in JVector point)
Parameters
pointJVector
Returns
- bool
False if the seed is degenerate, unsupported, or cannot be evaluated.