Const correctness fixes

This commit is contained in:
Jack Andersen 2016-04-15 17:23:54 -10:00
parent e284c2de31
commit cfc5d55419
2 changed files with 12 additions and 8 deletions

View File

@ -180,11 +180,11 @@ public:
CQuaternion exp() const;
float dot(const CQuaternion& quat);
float dot(const CQuaternion& quat) const;
static CQuaternion lerp(CQuaternion& a, CQuaternion& b, double t);
static CQuaternion slerp(CQuaternion& a, CQuaternion& b, double t);
static CQuaternion nlerp(CQuaternion& a, CQuaternion& b, double t);
static CQuaternion lerp(const CQuaternion& a, const CQuaternion& b, double t);
static CQuaternion slerp(const CQuaternion& a, const CQuaternion& b, double t);
static CQuaternion nlerp(const CQuaternion& a, const CQuaternion& b, double t);
inline float roll() const
{
@ -209,6 +209,8 @@ public:
__m128 mVec128;
struct { float w, x, y, z; };
};
static const CQuaternion skNoRotation;
};
CQuaternion operator+(float lhs, const CQuaternion& rhs);

View File

@ -3,6 +3,8 @@
namespace zeus
{
CQuaternion const CQuaternion::skNoRotation;
void CQuaternion::fromVector3f(const CVector3f& vec)
{
float cosX = std::cos(0.5f * vec.x);
@ -215,22 +217,22 @@ CQuaternion CQuaternion::exp() const
return ret;
}
float CQuaternion::dot(const CQuaternion& b)
float CQuaternion::dot(const CQuaternion& b) const
{
return x * b.x + y * b.y + z * b.z + w * b.w;
}
CQuaternion CQuaternion::lerp(CQuaternion& a, CQuaternion& b, double t)
CQuaternion CQuaternion::lerp(const CQuaternion& a, const CQuaternion& b, double t)
{
return (a + t * (b - a));
}
CQuaternion CQuaternion::nlerp(CQuaternion& a, CQuaternion& b, double t)
CQuaternion CQuaternion::nlerp(const CQuaternion& a, const CQuaternion& b, double t)
{
return lerp(a, b, t).normalized();
}
CQuaternion CQuaternion::slerp(CQuaternion& a, CQuaternion& b, double t)
CQuaternion CQuaternion::slerp(const CQuaternion& a, const CQuaternion& b, double t)
{
if (t <= 0.0f)
return a;