fix 'safeNormalize' (probably should remove it)
Fix for Issue 953: cull degenerate triangles https://github.com/bulletphysics/bullet3/issues/935 Thanks to Oleg Klimov for the report and reproduction case.
This commit is contained in:
@@ -291,14 +291,16 @@ public:
|
||||
|
||||
SIMD_FORCE_INLINE btVector3& safeNormalize()
|
||||
{
|
||||
btVector3 absVec = this->absolute();
|
||||
int maxIndex = absVec.maxAxis();
|
||||
if (absVec[maxIndex]>0)
|
||||
btScalar l2 = length2();
|
||||
//triNormal.normalize();
|
||||
if (l2 >= SIMD_EPSILON*SIMD_EPSILON)
|
||||
{
|
||||
*this /= absVec[maxIndex];
|
||||
return *this /= length();
|
||||
(*this) /= btSqrt(l2);
|
||||
}
|
||||
else
|
||||
{
|
||||
setValue(1, 0, 0);
|
||||
}
|
||||
setValue(1,0,0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user