1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

More 'const', so that Rotate(vector) can be called on a const hsQuat&.

This commit is contained in:
Christian Walther
2012-04-18 20:45:52 +02:00
parent a31f14a9bd
commit 67f6823f73
2 changed files with 4 additions and 4 deletions

View File

@ -65,14 +65,14 @@ hsQuat::hsQuat(float rad, const hsVector3* axis)
fZ = axis->fZ*s;
}
hsQuat hsQuat::Inverse()
hsQuat hsQuat::Inverse() const
{
hsQuat q2 = Conjugate();
float 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);

View File

@ -71,7 +71,7 @@ public:
{ fX = X; fY = Y; fZ = Z; fW = W; }
void GetAngleAxis(float *rad, hsVector3 *axis) const;
void SetAngleAxis(const float rad, const hsVector3 &axis);
hsPoint3 Rotate(const hsScalarTriple* v);
hsPoint3 Rotate(const hsScalarTriple* v) const;
// Access operators
float& operator[](int i) { return (&fX)[i]; }
@ -94,7 +94,7 @@ public:
float 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;