added existing demos to CMake build system

thanks to http://code.google.com/p/bullet/issues/detail?id=209
Added helper method 'getAxis' to btQuaternion,
thanks to Tully.Foote, http://code.google.com/p/bullet/issues/detail?id=205
This commit is contained in:
erwin.coumans
2009-05-06 22:03:22 +00:00
parent d9c4529a26
commit 7a210546cf
15 changed files with 342 additions and 5 deletions

View File

@@ -209,8 +209,17 @@ public:
return s;
}
/**@brief Return the axis of the rotation represented by this quaternion */
btVector3 getAxis() const
{
btScalar s_squared = btScalar(1.) - btPow(m_floats[3], btScalar(2.));
if (s_squared < btScalar(10.) * SIMD_EPSILON) //Check for divide by zero
return btVector3(1.0, 0.0, 0.0); // Arbitrary
btScalar s = btSqrt(s_squared);
return btVector3(m_floats[0] / s, m_floats[1] / s, m_floats[2] / s);
}
/**@brief Return the inverse of this quaternion */
/**@brief Return the inverse of this quaternion */
btQuaternion inverse() const
{
return btQuaternion(-m_floats[0], -m_floats[1], -m_floats[2], m_floats[3]);