![]() |
Jolt Physics
A multi core friendly Game Physics Engine
|
A convex hull builder that tries to create hulls as accurately as possible. Used for offline processing. More...
#include <ConvexHullBuilder.h>
Classes | |
| class | Edge |
| Class that holds the information of an edge. More... | |
| class | Face |
| Class that holds the information of one face. More... | |
Public Types | |
| enum class | EResult { Success , MaxVerticesReached , TooFewPoints , TooFewFaces , Degenerate } |
| Result enum that indicates how the hull got created. More... | |
| using | ConflictList = Array<int> |
| using | Positions = Array<Vec3> |
| using | Faces = Array<Face *> |
Public Member Functions | |
| ConvexHullBuilder (const Positions &inPositions) | |
| Constructor. | |
| ~ConvexHullBuilder () | |
| Destructor. | |
| EResult | Initialize (int inMaxVertices, float inTolerance, const char *&outError) |
| int | GetNumVerticesUsed () const |
| Returns the amount of vertices that are currently used by the hull. | |
| bool | ContainsFace (const Array< int > &inIndices) const |
| Returns true if the hull contains a polygon with inIndices (counter clockwise indices in mPositions) | |
| void | GetCenterOfMassAndVolume (Vec3 &outCenterOfMass, float &outVolume) const |
| Calculate the center of mass and the volume of the current convex hull. | |
| void | DetermineMaxError (Face *&outFaceWithMaxError, float &outMaxError, int &outMaxErrorPositionIdx, float &outCoplanarDistance) const |
| const Faces & | GetFaces () const |
| Access to the created faces. Memory is owned by the convex hull builder. | |
Public Member Functions inherited from NonCopyable | |
| NonCopyable ()=default | |
| NonCopyable (const NonCopyable &)=delete | |
| void | operator= (const NonCopyable &)=delete |
A convex hull builder that tries to create hulls as accurately as possible. Used for offline processing.
|
strong |
Result enum that indicates how the hull got created.
|
inline |
Destructor.
Returns true if the hull contains a polygon with inIndices (counter clockwise indices in mPositions)
| void ConvexHullBuilder::DetermineMaxError | ( | Face *& | outFaceWithMaxError, |
| float & | outMaxError, | ||
| int & | outMaxErrorPositionIdx, | ||
| float & | outCoplanarDistance ) const |
Determines the point that is furthest outside of the hull and reports how far it is outside of the hull (which indicates a failure during hull building)
| outFaceWithMaxError | The face that caused the error |
| outMaxError | The maximum distance of a point to the hull |
| outMaxErrorPositionIdx | The index of the point that had this distance |
| outCoplanarDistance | Points that are less than this distance from the hull are considered on the hull. This should be used as a lowerbound for the allowed error. |
| void ConvexHullBuilder::GetCenterOfMassAndVolume | ( | Vec3 & | outCenterOfMass, |
| float & | outVolume ) const |
Calculate the center of mass and the volume of the current convex hull.
Access to the created faces. Memory is owned by the convex hull builder.
| int ConvexHullBuilder::GetNumVerticesUsed | ( | ) | const |
Returns the amount of vertices that are currently used by the hull.
| ConvexHullBuilder::EResult ConvexHullBuilder::Initialize | ( | int | inMaxVertices, |
| float | inTolerance, | ||
| const char *& | outError ) |
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
| inMaxVertices | Max vertices to allow in the hull. Specify INT_MAX if there is no limit. |
| inTolerance | Max distance that a point is allowed to be outside of the hull |
| outError | Error message when building fails |