mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
mQuat.h change to fix QuatF::angleBetween
The old version doesn't have that 2.0f in the return that seems to be needed. Also added normalizing inside so it can be used for not-normalized quaternions too.
This commit is contained in:
parent
e8d1238794
commit
3630f97ab1
1 changed files with 7 additions and 2 deletions
|
|
@ -227,8 +227,13 @@ inline F32 QuatF::dot( const QuatF &q ) const
|
||||||
|
|
||||||
inline F32 QuatF::angleBetween( const QuatF & q )
|
inline F32 QuatF::angleBetween( const QuatF & q )
|
||||||
{
|
{
|
||||||
// angle between to quaternions
|
// angle between two quaternions
|
||||||
return mAcos(x * q.x + y * q.y + z * q.z + w * q.w);
|
QuatF base(x,y,z,w);
|
||||||
|
base=base.normalize();
|
||||||
|
QuatF q_norm=q;
|
||||||
|
q_norm=q_norm.normalize();
|
||||||
|
return 2.0f*mAcos(base.dot(q_norm));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // _MQUAT_H_
|
#endif // _MQUAT_H_
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue