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

@ -43,9 +43,7 @@ struct b3QHull : public b3Hull
}
// Create a convex hull from an array of points.
// The counter must be in the range [0, B3_MAX_HULL_VERTICES].
// Coincident points are removed.
// Some coplanar faces are merged.
// If the creation has failed then this convex hull is not modified.
void Set(const b3Vec3* points, u32 count);
// Set this hull as a cylinder located at the origin.

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;