Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
EPAConvexHullBuilder Class Reference

A convex hull builder specifically made for the EPA penetration depth calculation. It trades accuracy for speed and will simply abort of the hull forms defects due to numerical precision problems. More...

#include <EPAConvexHullBuilder.h>

Inheritance diagram for EPAConvexHullBuilder:
NonCopyable

Classes

class  Edge
 Class that holds the information of an edge. More...
 
class  Points
 Specialized points list that allows direct access to the size. More...
 
class  Triangle
 Class that holds the information of one triangle. More...
 
class  TriangleFactory
 Factory that creates triangles in a fixed size buffer. More...
 
class  TriangleQueue
 Specialized triangles list that keeps them sorted on closest distance to origin. More...
 

Public Types

using Edges = StaticArray< Edge, cMaxEdgeLength >
 
using NewTriangles = StaticArray< Triangle *, cMaxEdgeLength >
 
using PointsBase = StaticArray< Vec3, cMaxPoints >
 
using Triangles = StaticArray< Triangle *, cMaxTriangles >
 

Public Member Functions

 EPAConvexHullBuilder (const Points &inPositions)
 Constructor. More...
 
void Initialize (int inIdx1, int inIdx2, int inIdx3)
 Initialize the hull with 3 points. More...
 
bool HasNextTriangle () const
 Check if there's another triangle to process from the queue. More...
 
TrianglePeekClosestTriangleInQueue ()
 Access to the next closest triangle to the origin (won't remove it from the queue). More...
 
TrianglePopClosestTriangleFromQueue ()
 Access to the next closest triangle to the origin and remove it from the queue. More...
 
TriangleFindFacingTriangle (Vec3Arg inPosition, float &outBestDistSq)
 
bool AddPoint (Triangle *inFacingTriangle, int inIdx, float inClosestDistSq, NewTriangles &outTriangles)
 Add a new point to the convex hull. More...
 
void FreeTriangle (Triangle *inT)
 Free a triangle. More...
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Static Public Attributes

static constexpr int cMaxTriangles = 256
 Max triangles in hull. More...
 
static constexpr int cMaxPoints = cMaxTriangles / 2
 Max number of points in hull. More...
 
static constexpr int cMaxEdgeLength = 128
 Max number of edges in FindEdge. More...
 
static constexpr float cMinTriangleArea = 1.0e-10f
 Minimum area of a triangle before, if smaller than this it will not be added to the priority queue. More...
 
static constexpr float cBarycentricEpsilon = 1.0e-3f
 Epsilon value used to determine if a point is in the interior of a triangle. More...
 

Detailed Description

A convex hull builder specifically made for the EPA penetration depth calculation. It trades accuracy for speed and will simply abort of the hull forms defects due to numerical precision problems.

Member Typedef Documentation

◆ Edges

◆ NewTriangles

◆ PointsBase

◆ Triangles

Constructor & Destructor Documentation

◆ EPAConvexHullBuilder()

EPAConvexHullBuilder::EPAConvexHullBuilder ( const Points inPositions)
inlineexplicit

Constructor.

Member Function Documentation

◆ AddPoint()

bool EPAConvexHullBuilder::AddPoint ( Triangle inFacingTriangle,
int  inIdx,
float  inClosestDistSq,
NewTriangles outTriangles 
)
inline

Add a new point to the convex hull.

◆ FindFacingTriangle()

Triangle * EPAConvexHullBuilder::FindFacingTriangle ( Vec3Arg  inPosition,
float &  outBestDistSq 
)
inline

Find the triangle on which inPosition is the furthest to the front Note this function works as long as all points added have been added with AddPoint(..., FLT_MAX).

◆ FreeTriangle()

void EPAConvexHullBuilder::FreeTriangle ( Triangle inT)
inline

Free a triangle.

◆ HasNextTriangle()

bool EPAConvexHullBuilder::HasNextTriangle ( ) const
inline

Check if there's another triangle to process from the queue.

◆ Initialize()

void EPAConvexHullBuilder::Initialize ( int  inIdx1,
int  inIdx2,
int  inIdx3 
)
inline

Initialize the hull with 3 points.

◆ PeekClosestTriangleInQueue()

Triangle * EPAConvexHullBuilder::PeekClosestTriangleInQueue ( )
inline

Access to the next closest triangle to the origin (won't remove it from the queue).

◆ PopClosestTriangleFromQueue()

Triangle * EPAConvexHullBuilder::PopClosestTriangleFromQueue ( )
inline

Access to the next closest triangle to the origin and remove it from the queue.

Member Data Documentation

◆ cBarycentricEpsilon

constexpr float EPAConvexHullBuilder::cBarycentricEpsilon = 1.0e-3f
staticconstexpr

Epsilon value used to determine if a point is in the interior of a triangle.

◆ cMaxEdgeLength

constexpr int EPAConvexHullBuilder::cMaxEdgeLength = 128
staticconstexpr

Max number of edges in FindEdge.

◆ cMaxPoints

constexpr int EPAConvexHullBuilder::cMaxPoints = cMaxTriangles / 2
staticconstexpr

Max number of points in hull.

◆ cMaxTriangles

constexpr int EPAConvexHullBuilder::cMaxTriangles = 256
staticconstexpr

Max triangles in hull.

◆ cMinTriangleArea

constexpr float EPAConvexHullBuilder::cMinTriangleArea = 1.0e-10f
staticconstexpr

Minimum area of a triangle before, if smaller than this it will not be added to the priority queue.


The documentation for this class was generated from the following file: