diff options
Diffstat (limited to 'extern/bullet2/src/LinearMath/btVector3.h')
-rw-r--r-- | extern/bullet2/src/LinearMath/btVector3.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/extern/bullet2/src/LinearMath/btVector3.h b/extern/bullet2/src/LinearMath/btVector3.h index 89685929288..112b70dd66b 100644 --- a/extern/bullet2/src/LinearMath/btVector3.h +++ b/extern/bullet2/src/LinearMath/btVector3.h @@ -297,7 +297,7 @@ public: SIMD_FORCE_INLINE btVector3& normalize() { - btAssert(length() != btScalar(0)); + btAssert(!fuzzyZero()); #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE) // dot product first @@ -685,9 +685,10 @@ public: return m_floats[0] == btScalar(0) && m_floats[1] == btScalar(0) && m_floats[2] == btScalar(0); } + SIMD_FORCE_INLINE bool fuzzyZero() const { - return length2() < SIMD_EPSILON; + return length2() < SIMD_EPSILON*SIMD_EPSILON; } SIMD_FORCE_INLINE void serialize(struct btVector3Data& dataOut) const; @@ -950,9 +951,9 @@ SIMD_FORCE_INLINE btScalar btVector3::distance(const btVector3& v) const SIMD_FORCE_INLINE btVector3 btVector3::normalized() const { - btVector3 norm = *this; + btVector3 nrm = *this; - return norm.normalize(); + return nrm.normalize(); } SIMD_FORCE_INLINE btVector3 btVector3::rotate( const btVector3& wAxis, const btScalar _angle ) const @@ -1010,21 +1011,21 @@ SIMD_FORCE_INLINE long btVector3::maxDot( const btVector3 *array, long arra if( array_count < scalar_cutoff ) #endif { - btScalar maxDot = -SIMD_INFINITY; + btScalar maxDot1 = -SIMD_INFINITY; int i = 0; int ptIndex = -1; for( i = 0; i < array_count; i++ ) { btScalar dot = array[i].dot(*this); - if( dot > maxDot ) + if( dot > maxDot1 ) { - maxDot = dot; + maxDot1 = dot; ptIndex = i; } } - dotOut = maxDot; + dotOut = maxDot1; return ptIndex; } #if (defined BT_USE_SSE && defined BT_USE_SIMD_VECTOR3 && defined BT_USE_SSE_IN_API) || defined (BT_USE_NEON) |