Files
TCPlayerbotCore/dep/include/g3dlite/G3D/Quat.inl
T

37 lines
765 B
C++
Raw Normal View History

2008-10-02 16:23:55 -05:00
/**
Quat.inl
2009-10-17 16:20:24 -07:00
@cite Quaternion implementation based on Watt & Watt page 363.
2008-10-02 16:23:55 -05:00
Thanks to Max McGuire for slerp optimizations.
2009-10-17 16:20:24 -07:00
2008-10-02 16:23:55 -05:00
@maintainer Morgan McGuire, [email protected]
2009-10-17 16:20:24 -07:00
2008-10-02 16:23:55 -05:00
@created 2002-01-23
@edited 2004-03-04
*/
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
namespace G3D {
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
inline float& Quat::operator[] (int i) {
debugAssert(i >= 0);
debugAssert(i < 4);
return ((float*)this)[i];
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
inline const float& Quat::operator[] (int i) const {
debugAssert(i >= 0);
debugAssert(i < 4);
return ((float*)this)[i];
}
inline Quat Quat::operator-(const Quat& other) const {
return Quat(x - other.x, y - other.y, z - other.z, w - other.w);
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
inline Quat Quat::operator+(const Quat& other) const {
return Quat(x + other.x, y + other.y, z + other.z, w + other.w);
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
}