prepared some unit test for LinearMath

This commit is contained in:
erwin.coumans
2010-07-24 01:16:42 +00:00
parent a983353f34
commit 9bee6f6afd
5 changed files with 166 additions and 87 deletions

View File

@@ -148,6 +148,19 @@ public:
* This is symantically treating the vector like a point */
SIMD_FORCE_INLINE btScalar distance(const btVector3& v) const;
SIMD_FORCE_INLINE btVector3& safeNormalize()
{
btVector3 absVec = this->absolute();
int maxIndex = absVec.maxAxis();
if (absVec[maxIndex]>0)
{
*this /= absVec[maxIndex];
return *this /= length();
}
setValue(1,0,0);
return *this;
}
/**@brief Normalize this vector
* x^2 + y^2 + z^2 = 1 */
SIMD_FORCE_INLINE btVector3& normalize()