improvements in slerp
thanks to Tully Foote: http://code.google.com/p/bullet/issues/detail?id=140 minor warning fix in btHashMap.h
This commit is contained in:
@@ -47,7 +47,7 @@ struct btHashString
|
||||
return( ret );
|
||||
}
|
||||
|
||||
const bool equals(const btHashString& other) const
|
||||
bool equals(const btHashString& other) const
|
||||
{
|
||||
return (m_string == other.m_string) ||
|
||||
(0==portableStringCompare(m_string,other.m_string));
|
||||
|
||||
@@ -285,10 +285,17 @@ public:
|
||||
btScalar d = btScalar(1.0) / btSin(theta);
|
||||
btScalar s0 = btSin((btScalar(1.0) - t) * theta);
|
||||
btScalar s1 = btSin(t * theta);
|
||||
return btQuaternion((m_floats[0] * s0 + q.x() * s1) * d,
|
||||
(m_floats[1] * s0 + q.y() * s1) * d,
|
||||
(m_floats[2] * s0 + q.z() * s1) * d,
|
||||
(m_floats[3] * s0 + q.m_floats[3] * s1) * d);
|
||||
if (dot(q) < 0) // Take care of long angle case see http://en.wikipedia.org/wiki/Slerp
|
||||
return btQuaternion((m_floats[0] * s0 + -q.x() * s1) * d,
|
||||
(m_floats[1] * s0 + -q.y() * s1) * d,
|
||||
(m_floats[2] * s0 + -q.z() * s1) * d,
|
||||
(m_floats[3] * s0 + -q.m_floats[3] * s1) * d);
|
||||
else
|
||||
return btQuaternion((m_floats[0] * s0 + q.x() * s1) * d,
|
||||
(m_floats[1] * s0 + q.y() * s1) * d,
|
||||
(m_floats[2] * s0 + q.z() * s1) * d,
|
||||
(m_floats[3] * s0 + q.m_floats[3] * s1) * d);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user