From 8e43df15b117ce6850bf2eaefae416484f2de83e Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Wed, 18 Apr 2012 20:45:52 +0200 Subject: [PATCH] More 'const', so that Rotate(vector) can be called on a const hsQuat&. --- .../Plasma20/Sources/Plasma/CoreLib/hsQuat.cpp | 4 ++-- .../Plasma20/Sources/Plasma/CoreLib/hsQuat.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.cpp index 8c7c4353..64d6c18e 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.cpp @@ -65,14 +65,14 @@ hsQuat::hsQuat(hsScalar rad, const hsVector3* axis) fZ = axis->fZ*s; } -hsQuat hsQuat::Inverse() +hsQuat hsQuat::Inverse() const { hsQuat q2 = Conjugate(); hsScalar msInv = 1.0f/q2.MagnitudeSquared(); return (q2 * msInv); } -hsPoint3 hsQuat::Rotate(const hsScalarTriple* v) +hsPoint3 hsQuat::Rotate(const hsScalarTriple* v) const { hsQuat qInv = Inverse(); hsQuat qVec(v->fX, v->fY, v->fZ, 0); diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.h b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.h index 8fe5afda..7d4cb54f 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.h +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.h @@ -71,7 +71,7 @@ public: { fX = X; fY = Y; fZ = Z; fW = W; } void GetAngleAxis(hsScalar *rad, hsVector3 *axis) const; void SetAngleAxis(const hsScalar rad, const hsVector3 &axis); - hsPoint3 Rotate(const hsScalarTriple* v); + hsPoint3 Rotate(const hsScalarTriple* v) const; // Access operators hsScalar& operator[](int i) { return (&fX)[i]; } @@ -94,7 +94,7 @@ public: hsScalar MagnitudeSquared(); hsQuat Conjugate() const { return hsQuat(-fX,-fY,-fZ,fW); } - hsQuat Inverse(); + hsQuat Inverse() const; // Binary operators hsQuat operator-(const hsQuat&) const; hsQuat operator+(const hsQuat&) const;