revert quickSort change in commit http://code.google.com/p/bullet/source/detail?r=2527 and fix the underlying sort issue

in VoronoiFractureDemo (store intermediate values in memory to avoid problems)
@todo: rewrite the island management to avoid sort for better performance
Thanks to Peter Kyme for the report, fixes Issue 607
This commit is contained in:
erwin.coumans
2012-03-14 03:52:29 +00:00
parent 52f9f6ed09
commit 76375afff2
3 changed files with 33 additions and 38 deletions

View File

@@ -184,7 +184,12 @@ struct pointCmp
{
bool operator()(const btVector3& p1, const btVector3& p2) const
{
return ((p1-curVoronoiPoint).length2() < (p2-curVoronoiPoint).length2());
float v1 = (p1-curVoronoiPoint).length2();
float v2 = (p2-curVoronoiPoint).length2();
bool result0 = v1 < v2;
//bool result1 = ((btScalar)(p1-curVoronoiPoint).length2()) < ((btScalar)(p2-curVoronoiPoint).length2());
//apparently result0 is not always result1, because extended precision used in registered is different from precision when values are stored in memory
return result0;
}
};