use heap sort instead of quicksort

This commit is contained in:
erwin.coumans
2012-03-22 17:43:17 +00:00
parent da54814d09
commit 0d077293a5

View File

@@ -178,7 +178,7 @@ void VoronoiFractureDemo::getVerticesInsidePlanes(const btAlignedObjectArray<btV
}
}
static btVector3 curVoronoiPoint; // Here for btAlignedObjectArray.quickSort pointCmp scope
static btVector3 curVoronoiPoint;
struct pointCmp
{
@@ -230,7 +230,7 @@ void VoronoiFractureDemo::voronoiBBShatter(const btAlignedObjectArray<btVector3>
planes[4] = -bbvy; planes[4][3] = nrbb.y();
planes[5] = -bbvz; planes[5][3] = nrbb.z();
maxDistance = SIMD_INFINITY;
sortedVoronoiPoints.quickSort(pointCmp());
sortedVoronoiPoints.heapSort(pointCmp());
for (j=1; j < numpoints; j++) {
normal = sortedVoronoiPoints[j] - curVoronoiPoint;
nlength = normal.length();
@@ -375,7 +375,7 @@ void VoronoiFractureDemo::voronoiConvexHullShatter(const btAlignedObjectArray<bt
planes[j][3] += planes[j].dot(curVoronoiPoint);
}
maxDistance = SIMD_INFINITY;
sortedVoronoiPoints.quickSort(pointCmp());
sortedVoronoiPoints.heapSort(pointCmp());
for (j=1; j < numpoints; j++) {
normal = sortedVoronoiPoints[j] - curVoronoiPoint;
nlength = normal.length();