comment, bugfix, and simplification
This commit is contained in:
parent
9b01af3d70
commit
75fe47b453
@ -26,12 +26,9 @@ struct b3QHull : public b3Hull
|
||||
b3QHull();
|
||||
~b3QHull();
|
||||
|
||||
// Create a convex hull from a point list.
|
||||
// If the point list defines a degenerate polyhedron
|
||||
// the old hull is not cleared.
|
||||
//
|
||||
// Create a convex hull from an array of points.
|
||||
// If the points define a degenerate polyhedron the hull is not overwritten.
|
||||
// Coincident points are removed.
|
||||
// Coplanar faces are merged.
|
||||
void Set(const b3Vec3* points, u32 count);
|
||||
|
||||
// Set this hull as a cylinder located at the origin.
|
||||
|
@ -151,7 +151,7 @@ static b3Vec3 b3ComputeCentroid(b3QHull* hull)
|
||||
void b3QHull::Set(const b3Vec3* points, u32 count)
|
||||
{
|
||||
// Copy points into local buffer, remove coincident points.
|
||||
b3StackArray<b3Vec3, 256> ps;
|
||||
b3StackArray<b3Vec3, B3_MAX_HULL_FEATURES> ps;
|
||||
for (u32 i = 0; i < count; ++i)
|
||||
{
|
||||
b3Vec3 p = points[i];
|
||||
@ -209,27 +209,16 @@ void b3QHull::Set(const b3Vec3* points, u32 count)
|
||||
face = face->next;
|
||||
}
|
||||
|
||||
if (V > B3_MAX_HULL_FEATURES)
|
||||
if (V > B3_MAX_HULL_FEATURES || E > B3_MAX_HULL_FEATURES || F > B3_MAX_HULL_FEATURES)
|
||||
{
|
||||
b3Free(qh_memory);
|
||||
return;
|
||||
}
|
||||
|
||||
if (E > B3_MAX_HULL_FEATURES)
|
||||
{
|
||||
b3Free(qh_memory);
|
||||
return;
|
||||
}
|
||||
|
||||
if (F > B3_MAX_HULL_FEATURES)
|
||||
{
|
||||
b3Free(qh_memory);
|
||||
return;
|
||||
}
|
||||
|
||||
b3Free(vertices);
|
||||
b3Free(edges);
|
||||
b3Free(faces);
|
||||
b3Free(planes);
|
||||
|
||||
vertexCount = 0;
|
||||
vertices = (b3Vec3*)b3Alloc(V * sizeof(b3Vec3));
|
||||
|
Loading…
x
Reference in New Issue
Block a user