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

A convex hull builder that tries to create 2D hulls as accurately as possible. Used for offline processing. More...

#include <ConvexHullBuilder2D.h>

Inheritance diagram for ConvexHullBuilder2D:
NonCopyable

Public Types

enum class  EResult { Success , MaxVerticesReached }
 Result enum that indicates how the hull got created. More...
 
using Positions = Array< Vec3 >
 
using Edges = Array< int >
 

Public Member Functions

 ConvexHullBuilder2D (const Positions &inPositions)
 
 ~ConvexHullBuilder2D ()
 Destructor.
 
EResult Initialize (int inIdx1, int inIdx2, int inIdx3, int inMaxVertices, float inTolerance, Edges &outEdges)
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Detailed Description

A convex hull builder that tries to create 2D hulls as accurately as possible. Used for offline processing.

Member Typedef Documentation

◆ Edges

◆ Positions

Member Enumeration Documentation

◆ EResult

enum class ConvexHullBuilder2D::EResult
strong

Result enum that indicates how the hull got created.

Enumerator
Success 

Hull building finished successfully.

MaxVerticesReached 

Hull building finished successfully, but the desired accuracy was not reached because the max vertices limit was reached.

Constructor & Destructor Documentation

◆ ConvexHullBuilder2D()

ConvexHullBuilder2D::ConvexHullBuilder2D ( const Positions inPositions)
explicit

Constructor

Parameters
inPositionsPositions used to make the hull. Uses X and Y component of Vec3 only!

◆ ~ConvexHullBuilder2D()

ConvexHullBuilder2D::~ConvexHullBuilder2D ( )

Destructor.

Member Function Documentation

◆ Initialize()

ConvexHullBuilder2D::EResult ConvexHullBuilder2D::Initialize ( int  inIdx1,
int  inIdx2,
int  inIdx3,
int  inMaxVertices,
float  inTolerance,
Edges outEdges 
)

Takes all positions as provided by the constructor and use them to build a hull Any points that are closer to the hull than inTolerance will be discarded

Parameters
inIdx1,inIdx2,inIdx3The indices to use as initial hull (in any order)
inMaxVerticesMax vertices to allow in the hull. Specify INT_MAX if there is no limit.
inToleranceMax distance that a point is allowed to be outside of the hull
outEdgesOn success this will contain the list of indices that form the hull (counter clockwise)
Returns
Status code that reports if the hull was created or not

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