face merging control in convex hull simplification; more asserts; consistency; now user can pass arbitrary number of vertices to b3QHull

This commit is contained in:
Irlan
2018-05-11 03:14:17 -03:00
parent 4da08af7fa
commit 6c136123d9
4 changed files with 143 additions and 100 deletions

View File

@@ -95,8 +95,6 @@ struct qhVertex
// A convex hull builder.
// Given a list of points constructs its convex hull.
// The output convex hull might contain polygonal faces and not only triangles.
// Coplanar face merging is necessary for stable physics simulation.
class qhHull
{
public:
@@ -112,26 +110,12 @@ public:
// Get the list of faces in this convex hull.
const qhList<qhFace>& GetFaceList() const;
// Get the number of Quickhull iterations.
u32 GetIterations() const;
// Translate this hull.
void Translate(const b3Vec3& translation);
// Get the number of iterations this algorithm ran.
u32 GetIterations() const;
// Validate convexity.
// Called at each iteration.
void ValidateConvexity() const;
// Validate connectivity.
// Called at each iteration.
void Validate() const;
// Called anywhere.
void Validate(const qhFace* face) const;
// Called anywhere.
void Validate(const qhHalfEdge* edge) const;
// Draw this hull.
void Draw() const;
private:
@@ -141,6 +125,7 @@ private:
qhFace* RemoveEdge(qhHalfEdge* edge);
qhFace* AddFace(qhVertex* v1, qhVertex* v2, qhVertex* v3);
qhFace* RemoveFace(qhFace* face);
bool MergeFace(qhFace* face);
@@ -164,6 +149,20 @@ private:
void ResolveOrphans();
// Validate convexity.
// Called at each iteration.
void ValidateConvexity() const;
// Validate connectivity.
// Called at each iteration.
void Validate() const;
// Called anywhere.
void Validate(const qhFace* face) const;
// Called anywhere.
void Validate(const qhHalfEdge* edge) const;
// List of active vertices
qhList<qhVertex> m_vertexList;