|
|
@@ -1,9 +1,6 @@
|
|
|
#include "Common.inl.h"
|
|
|
|
|
|
|
|
|
-#define SELF (*this)
|
|
|
-
|
|
|
-
|
|
|
namespace M {
|
|
|
|
|
|
|
|
|
@@ -16,7 +13,7 @@ inline Mat3::Mat3(float f)
|
|
|
{
|
|
|
for(int i = 0; i < 9; i++)
|
|
|
{
|
|
|
- SELF[i] = f;
|
|
|
+ (*this)[i] = f;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -25,7 +22,7 @@ inline Mat3::Mat3(float arr [])
|
|
|
{
|
|
|
for(int i = 0; i < 9; i++)
|
|
|
{
|
|
|
- SELF[i] = arr[i];
|
|
|
+ (*this)[i] = arr[i];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -33,15 +30,15 @@ inline Mat3::Mat3(float arr [])
|
|
|
inline Mat3::Mat3(float m00, float m01, float m02, float m10, float m11,
|
|
|
float m12, float m20, float m21, float m22)
|
|
|
{
|
|
|
- SELF(0, 0) = m00;
|
|
|
- SELF(0, 1) = m01;
|
|
|
- SELF(0, 2) = m02;
|
|
|
- SELF(1, 0) = m10;
|
|
|
- SELF(1, 1) = m11;
|
|
|
- SELF(1, 2) = m12;
|
|
|
- SELF(2, 0) = m20;
|
|
|
- SELF(2, 1) = m21;
|
|
|
- SELF(2, 2) = m22;
|
|
|
+ (*this)(0, 0) = m00;
|
|
|
+ (*this)(0, 1) = m01;
|
|
|
+ (*this)(0, 2) = m02;
|
|
|
+ (*this)(1, 0) = m10;
|
|
|
+ (*this)(1, 1) = m11;
|
|
|
+ (*this)(1, 2) = m12;
|
|
|
+ (*this)(2, 0) = m20;
|
|
|
+ (*this)(2, 1) = m21;
|
|
|
+ (*this)(2, 2) = m22;
|
|
|
}
|
|
|
|
|
|
// Copy
|
|
|
@@ -49,7 +46,7 @@ inline Mat3::Mat3(const Mat3& b)
|
|
|
{
|
|
|
for(int i = 0; i < 9; i++)
|
|
|
{
|
|
|
- SELF[i] = b[i];
|
|
|
+ (*this)[i] = b[i];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -74,17 +71,17 @@ inline Mat3::Mat3(const Quat& q)
|
|
|
yz = q.y() * zs;
|
|
|
zz = q.z() * zs;
|
|
|
|
|
|
- SELF(0, 0) = 1.0 - (yy + zz);
|
|
|
- SELF(0, 1) = xy - wz;
|
|
|
- SELF(0, 2) = xz + wy;
|
|
|
+ (*this)(0, 0) = 1.0 - (yy + zz);
|
|
|
+ (*this)(0, 1) = xy - wz;
|
|
|
+ (*this)(0, 2) = xz + wy;
|
|
|
|
|
|
- SELF(1, 0) = xy + wz;
|
|
|
- SELF(1, 1) = 1.0 - (xx + zz);
|
|
|
- SELF(1, 2) = yz - wx;
|
|
|
+ (*this)(1, 0) = xy + wz;
|
|
|
+ (*this)(1, 1) = 1.0 - (xx + zz);
|
|
|
+ (*this)(1, 2) = yz - wx;
|
|
|
|
|
|
- SELF(2, 0) = xz - wy;
|
|
|
- SELF(2, 1) = yz + wx;
|
|
|
- SELF(2, 2) = 1.0 - (xx + yy);
|
|
|
+ (*this)(2, 0) = xz - wy;
|
|
|
+ (*this)(2, 1) = yz + wx;
|
|
|
+ (*this)(2, 2) = 1.0 - (xx + yy);
|
|
|
}
|
|
|
|
|
|
// Euler
|
|
|
@@ -95,15 +92,15 @@ inline Mat3::Mat3(const Euler& e)
|
|
|
sinCos(e.z(), sa, ca);
|
|
|
sinCos(e.x(), sb, cb);
|
|
|
|
|
|
- SELF(0, 0) = ch * ca;
|
|
|
- SELF(0, 1) = sh * sb - ch * sa * cb;
|
|
|
- SELF(0, 2) = ch * sa * sb + sh * cb;
|
|
|
- SELF(1, 0) = sa;
|
|
|
- SELF(1, 1) = ca * cb;
|
|
|
- SELF(1, 2) = -ca * sb;
|
|
|
- SELF(2, 0) = -sh * ca;
|
|
|
- SELF(2, 1) = sh * sa * cb + ch * sb;
|
|
|
- SELF(2, 2) = -sh * sa * sb + ch * cb;
|
|
|
+ (*this)(0, 0) = ch * ca;
|
|
|
+ (*this)(0, 1) = sh * sb - ch * sa * cb;
|
|
|
+ (*this)(0, 2) = ch * sa * sb + sh * cb;
|
|
|
+ (*this)(1, 0) = sa;
|
|
|
+ (*this)(1, 1) = ca * cb;
|
|
|
+ (*this)(1, 2) = -ca * sb;
|
|
|
+ (*this)(2, 0) = -sh * ca;
|
|
|
+ (*this)(2, 1) = sh * sa * cb + ch * sb;
|
|
|
+ (*this)(2, 2) = -sh * sa * sb + ch * cb;
|
|
|
}
|
|
|
|
|
|
// Axisang
|
|
|
@@ -116,21 +113,21 @@ inline Mat3::Mat3(const Axisang& axisang)
|
|
|
float t = 1.0 - c;
|
|
|
|
|
|
const Vec3& axis = axisang.getAxis();
|
|
|
- SELF(0, 0) = c + axis.x() * axis.x() * t;
|
|
|
- SELF(1, 1) = c + axis.y() * axis.y() * t;
|
|
|
- SELF(2, 2) = c + axis.z() * axis.z() * t;
|
|
|
+ (*this)(0, 0) = c + axis.x() * axis.x() * t;
|
|
|
+ (*this)(1, 1) = c + axis.y() * axis.y() * t;
|
|
|
+ (*this)(2, 2) = c + axis.z() * axis.z() * t;
|
|
|
|
|
|
float tmp1 = axis.x() * axis.y() * t;
|
|
|
float tmp2 = axis.z() * s;
|
|
|
- SELF(1, 0) = tmp1 + tmp2;
|
|
|
- SELF(0, 1) = tmp1 - tmp2;
|
|
|
+ (*this)(1, 0) = tmp1 + tmp2;
|
|
|
+ (*this)(0, 1) = tmp1 - tmp2;
|
|
|
tmp1 = axis.x() * axis.z() * t;
|
|
|
tmp2 = axis.y() * s;
|
|
|
- SELF(2, 0) = tmp1 - tmp2;
|
|
|
- SELF(0, 2) = tmp1 + tmp2; tmp1 = axis.y() * axis.z() * t;
|
|
|
+ (*this)(2, 0) = tmp1 - tmp2;
|
|
|
+ (*this)(0, 2) = tmp1 + tmp2; tmp1 = axis.y() * axis.z() * t;
|
|
|
tmp2 = axis.x() * s;
|
|
|
- SELF(2, 1) = tmp1 + tmp2;
|
|
|
- SELF(1, 2) = tmp1 - tmp2;
|
|
|
+ (*this)(2, 1) = tmp1 + tmp2;
|
|
|
+ (*this)(1, 2) = tmp1 - tmp2;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -168,9 +165,9 @@ inline Mat3& Mat3::operator=(const Mat3& b)
|
|
|
{
|
|
|
for(int i = 0; i < 9; i++)
|
|
|
{
|
|
|
- SELF[i] = b[i];
|
|
|
+ (*this)[i] = b[i];
|
|
|
}
|
|
|
- return SELF;
|
|
|
+ return (*this);
|
|
|
}
|
|
|
|
|
|
// +
|
|
|
@@ -179,7 +176,7 @@ inline Mat3 Mat3::operator+(const Mat3& b) const
|
|
|
Mat3 c;
|
|
|
for(int i = 0; i < 9; i++)
|
|
|
{
|
|
|
- c[i] = SELF[i] + b[i];
|
|
|
+ c[i] = (*this)[i] + b[i];
|
|
|
}
|
|
|
return c;
|
|
|
}
|
|
|
@@ -189,9 +186,9 @@ inline Mat3& Mat3::operator+=(const Mat3& b)
|
|
|
{
|
|
|
for(int i = 0; i < 9; i++)
|
|
|
{
|
|
|
- SELF[i] += b[i];
|
|
|
+ (*this)[i] += b[i];
|
|
|
}
|
|
|
- return SELF;
|
|
|
+ return (*this);
|
|
|
}
|
|
|
|
|
|
// -
|
|
|
@@ -200,7 +197,7 @@ inline Mat3 Mat3::operator-(const Mat3& b) const
|
|
|
Mat3 c;
|
|
|
for(int i = 0; i < 9; i++)
|
|
|
{
|
|
|
- c[i] = SELF[i] - b[i];
|
|
|
+ c[i] = (*this)[i] - b[i];
|
|
|
}
|
|
|
return c;
|
|
|
}
|
|
|
@@ -210,41 +207,41 @@ inline Mat3& Mat3::operator-=(const Mat3& b)
|
|
|
{
|
|
|
for(int i = 0; i < 9; i++)
|
|
|
{
|
|
|
- SELF[i] -= b[i];
|
|
|
+ (*this)[i] -= b[i];
|
|
|
}
|
|
|
- return SELF;
|
|
|
+ return (*this);
|
|
|
}
|
|
|
|
|
|
// *
|
|
|
inline Mat3 Mat3::operator*(const Mat3& b) const
|
|
|
{
|
|
|
Mat3 c;
|
|
|
- c(0, 0) = SELF(0, 0) * b(0, 0) + SELF(0, 1) * b(1, 0) +
|
|
|
- SELF(0, 2) * b(2, 0);
|
|
|
- c(0, 1) = SELF(0, 0) * b(0, 1) + SELF(0, 1) * b(1, 1) +
|
|
|
- SELF(0, 2) * b(2, 1);
|
|
|
- c(0, 2) = SELF(0, 0) * b(0, 2) + SELF(0, 1) * b(1, 2) +
|
|
|
- SELF(0, 2) * b(2, 2);
|
|
|
- c(1, 0) = SELF(1, 0) * b(0, 0) + SELF(1, 1) * b(1, 0) +
|
|
|
- SELF(1, 2) * b(2, 0);
|
|
|
- c(1, 1) = SELF(1, 0) * b(0, 1) + SELF(1, 1) * b(1, 1) +
|
|
|
- SELF(1, 2) * b(2, 1);
|
|
|
- c(1, 2) = SELF(1, 0) * b(0, 2) + SELF(1, 1) * b(1, 2) +
|
|
|
- SELF(1, 2) * b(2, 2);
|
|
|
- c(2, 0) = SELF(2, 0) * b(0, 0) + SELF(2, 1) * b(1, 0) +
|
|
|
- SELF(2, 2) * b(2, 0);
|
|
|
- c(2, 1) = SELF(2, 0) * b(0, 1) + SELF(2, 1) * b(1, 1) +
|
|
|
- SELF(2, 2) * b(2, 1);
|
|
|
- c(2, 2) = SELF(2, 0) * b(0, 2) + SELF(2, 1) * b(1, 2) +
|
|
|
- SELF(2, 2) * b(2, 2);
|
|
|
+ c(0, 0) = (*this)(0, 0) * b(0, 0) + (*this)(0, 1) * b(1, 0) +
|
|
|
+ (*this)(0, 2) * b(2, 0);
|
|
|
+ c(0, 1) = (*this)(0, 0) * b(0, 1) + (*this)(0, 1) * b(1, 1) +
|
|
|
+ (*this)(0, 2) * b(2, 1);
|
|
|
+ c(0, 2) = (*this)(0, 0) * b(0, 2) + (*this)(0, 1) * b(1, 2) +
|
|
|
+ (*this)(0, 2) * b(2, 2);
|
|
|
+ c(1, 0) = (*this)(1, 0) * b(0, 0) + (*this)(1, 1) * b(1, 0) +
|
|
|
+ (*this)(1, 2) * b(2, 0);
|
|
|
+ c(1, 1) = (*this)(1, 0) * b(0, 1) + (*this)(1, 1) * b(1, 1) +
|
|
|
+ (*this)(1, 2) * b(2, 1);
|
|
|
+ c(1, 2) = (*this)(1, 0) * b(0, 2) + (*this)(1, 1) * b(1, 2) +
|
|
|
+ (*this)(1, 2) * b(2, 2);
|
|
|
+ c(2, 0) = (*this)(2, 0) * b(0, 0) + (*this)(2, 1) * b(1, 0) +
|
|
|
+ (*this)(2, 2) * b(2, 0);
|
|
|
+ c(2, 1) = (*this)(2, 0) * b(0, 1) + (*this)(2, 1) * b(1, 1) +
|
|
|
+ (*this)(2, 2) * b(2, 1);
|
|
|
+ c(2, 2) = (*this)(2, 0) * b(0, 2) + (*this)(2, 1) * b(1, 2) +
|
|
|
+ (*this)(2, 2) * b(2, 2);
|
|
|
return c;
|
|
|
}
|
|
|
|
|
|
// *=
|
|
|
inline Mat3& Mat3::operator*=(const Mat3& b)
|
|
|
{
|
|
|
- SELF = SELF * b;
|
|
|
- return SELF;
|
|
|
+ (*this) = (*this) * b;
|
|
|
+ return (*this);
|
|
|
}
|
|
|
|
|
|
// ==
|
|
|
@@ -252,7 +249,7 @@ inline bool Mat3::operator==(const Mat3& b) const
|
|
|
{
|
|
|
for(int i = 0; i < 9; i++)
|
|
|
{
|
|
|
- if(!isZero(SELF[i]-b[i]))
|
|
|
+ if(!isZero((*this)[i]-b[i]))
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
@@ -265,7 +262,7 @@ inline bool Mat3::operator!=(const Mat3& b) const
|
|
|
{
|
|
|
for(int i = 0; i < 9; i++)
|
|
|
{
|
|
|
- if(!isZero(SELF[i]-b[i]))
|
|
|
+ if(!isZero((*this)[i]-b[i]))
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
@@ -284,7 +281,7 @@ inline Mat3 Mat3::operator+(float f) const
|
|
|
Mat3 c;
|
|
|
for(uint i = 0; i < 9; i++)
|
|
|
{
|
|
|
- c[i] = SELF[i] + f;
|
|
|
+ c[i] = (*this)[i] + f;
|
|
|
}
|
|
|
return c;
|
|
|
}
|
|
|
@@ -300,9 +297,9 @@ inline Mat3& Mat3::operator+=(float f)
|
|
|
{
|
|
|
for(uint i = 0; i < 9; i++)
|
|
|
{
|
|
|
- SELF[i] += f;
|
|
|
+ (*this)[i] += f;
|
|
|
}
|
|
|
- return SELF;
|
|
|
+ return (*this);
|
|
|
}
|
|
|
|
|
|
// 3x3 - float
|
|
|
@@ -311,7 +308,7 @@ inline Mat3 Mat3::operator-(float f) const
|
|
|
Mat3 c;
|
|
|
for(uint i = 0; i < 9; i++)
|
|
|
{
|
|
|
- c[i] = SELF[i] - f;
|
|
|
+ c[i] = (*this)[i] - f;
|
|
|
}
|
|
|
return c;
|
|
|
}
|
|
|
@@ -332,9 +329,9 @@ inline Mat3& Mat3::operator-=(float f)
|
|
|
{
|
|
|
for(uint i = 0; i < 9; i++)
|
|
|
{
|
|
|
- SELF[i] -= f;
|
|
|
+ (*this)[i] -= f;
|
|
|
}
|
|
|
- return SELF;
|
|
|
+ return (*this);
|
|
|
}
|
|
|
|
|
|
// 3x3 * float
|
|
|
@@ -343,7 +340,7 @@ inline Mat3 Mat3::operator*(float f) const
|
|
|
Mat3 c;
|
|
|
for(uint i = 0; i < 9; i++)
|
|
|
{
|
|
|
- c[i] = SELF[i] * f;
|
|
|
+ c[i] = (*this)[i] * f;
|
|
|
}
|
|
|
return c;
|
|
|
}
|
|
|
@@ -364,9 +361,9 @@ inline Mat3& Mat3::operator*=(float f)
|
|
|
{
|
|
|
for(uint i = 0; i < 9; i++)
|
|
|
{
|
|
|
- SELF[i] *= f;
|
|
|
+ (*this)[i] *= f;
|
|
|
}
|
|
|
- return SELF;
|
|
|
+ return (*this);
|
|
|
}
|
|
|
|
|
|
// 3x3 / float
|
|
|
@@ -375,7 +372,7 @@ inline Mat3 Mat3::operator/(float f) const
|
|
|
Mat3 c;
|
|
|
for(uint i = 0; i < 9; i++)
|
|
|
{
|
|
|
- c[i] = SELF[i] / f;
|
|
|
+ c[i] = (*this)[i] / f;
|
|
|
}
|
|
|
return c;
|
|
|
}
|
|
|
@@ -396,9 +393,9 @@ inline Mat3& Mat3::operator/=(float f)
|
|
|
{
|
|
|
for(uint i = 0; i < 9; i++)
|
|
|
{
|
|
|
- SELF[i] /= f;
|
|
|
+ (*this)[i] /= f;
|
|
|
}
|
|
|
- return SELF;
|
|
|
+ return (*this);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -410,9 +407,9 @@ inline Mat3& Mat3::operator/=(float f)
|
|
|
inline Vec3 Mat3::operator*(const Vec3& b) const
|
|
|
{
|
|
|
return Vec3(
|
|
|
- SELF(0, 0) * b.x() + SELF(0, 1) * b.y() + SELF(0, 2) * b.z(),
|
|
|
- SELF(1, 0) * b.x() + SELF(1, 1) * b.y() + SELF(1, 2) * b.z(),
|
|
|
- SELF(2, 0) * b.x() + SELF(2, 1) * b.y() + SELF(2, 2) * b.z()
|
|
|
+ (*this)(0, 0) * b.x() + (*this)(0, 1) * b.y() + (*this)(0, 2) * b.z(),
|
|
|
+ (*this)(1, 0) * b.x() + (*this)(1, 1) * b.y() + (*this)(1, 2) * b.z(),
|
|
|
+ (*this)(2, 0) * b.x() + (*this)(2, 1) * b.y() + (*this)(2, 2) * b.z()
|
|
|
);
|
|
|
}
|
|
|
|
|
|
@@ -424,85 +421,85 @@ inline Vec3 Mat3::operator*(const Vec3& b) const
|
|
|
// setRows
|
|
|
inline void Mat3::setRows(const Vec3& a, const Vec3& b, const Vec3& c)
|
|
|
{
|
|
|
- SELF(0, 0) = a.x();
|
|
|
- SELF(0, 1) = a.y();
|
|
|
- SELF(0, 2) = a.z();
|
|
|
- SELF(1, 0) = b.x();
|
|
|
- SELF(1, 1) = b.y();
|
|
|
- SELF(1, 2) = b.z();
|
|
|
- SELF(2, 0) = c.x();
|
|
|
- SELF(2, 1) = c.y();
|
|
|
- SELF(2, 2) = c.z();
|
|
|
+ (*this)(0, 0) = a.x();
|
|
|
+ (*this)(0, 1) = a.y();
|
|
|
+ (*this)(0, 2) = a.z();
|
|
|
+ (*this)(1, 0) = b.x();
|
|
|
+ (*this)(1, 1) = b.y();
|
|
|
+ (*this)(1, 2) = b.z();
|
|
|
+ (*this)(2, 0) = c.x();
|
|
|
+ (*this)(2, 1) = c.y();
|
|
|
+ (*this)(2, 2) = c.z();
|
|
|
}
|
|
|
|
|
|
// setColumns
|
|
|
inline void Mat3::setColumns(const Vec3& a, const Vec3& b, const Vec3& c)
|
|
|
{
|
|
|
- SELF(0, 0) = a.x();
|
|
|
- SELF(1, 0) = a.y();
|
|
|
- SELF(2, 0) = a.z();
|
|
|
- SELF(0, 1) = b.x();
|
|
|
- SELF(1, 1) = b.y();
|
|
|
- SELF(2, 1) = b.z();
|
|
|
- SELF(0, 2) = c.x();
|
|
|
- SELF(1, 2) = c.y();
|
|
|
- SELF(2, 2) = c.z();
|
|
|
+ (*this)(0, 0) = a.x();
|
|
|
+ (*this)(1, 0) = a.y();
|
|
|
+ (*this)(2, 0) = a.z();
|
|
|
+ (*this)(0, 1) = b.x();
|
|
|
+ (*this)(1, 1) = b.y();
|
|
|
+ (*this)(2, 1) = b.z();
|
|
|
+ (*this)(0, 2) = c.x();
|
|
|
+ (*this)(1, 2) = c.y();
|
|
|
+ (*this)(2, 2) = c.z();
|
|
|
}
|
|
|
|
|
|
// getRows
|
|
|
inline void Mat3::getRows(Vec3& a, Vec3& b, Vec3& c) const
|
|
|
{
|
|
|
- a.x() = SELF(0, 0);
|
|
|
- a.y() = SELF(0, 1);
|
|
|
- a.z() = SELF(0, 2);
|
|
|
- b.x() = SELF(1, 0);
|
|
|
- b.y() = SELF(1, 1);
|
|
|
- b.z() = SELF(1, 2);
|
|
|
- c.x() = SELF(2, 0);
|
|
|
- c.y() = SELF(2, 1);
|
|
|
- c.z() = SELF(2, 2);
|
|
|
+ a.x() = (*this)(0, 0);
|
|
|
+ a.y() = (*this)(0, 1);
|
|
|
+ a.z() = (*this)(0, 2);
|
|
|
+ b.x() = (*this)(1, 0);
|
|
|
+ b.y() = (*this)(1, 1);
|
|
|
+ b.z() = (*this)(1, 2);
|
|
|
+ c.x() = (*this)(2, 0);
|
|
|
+ c.y() = (*this)(2, 1);
|
|
|
+ c.z() = (*this)(2, 2);
|
|
|
}
|
|
|
|
|
|
// getColumns
|
|
|
inline void Mat3::getColumns(Vec3& a, Vec3& b, Vec3& c) const
|
|
|
{
|
|
|
- a.x() = SELF(0, 0);
|
|
|
- a.y() = SELF(1, 0);
|
|
|
- a.z() = SELF(2, 0);
|
|
|
- b.x() = SELF(0, 1);
|
|
|
- b.y() = SELF(1, 1);
|
|
|
- b.z() = SELF(2, 1);
|
|
|
- c.x() = SELF(0, 2);
|
|
|
- c.y() = SELF(1, 2);
|
|
|
- c.z() = SELF(2, 2);
|
|
|
+ a.x() = (*this)(0, 0);
|
|
|
+ a.y() = (*this)(1, 0);
|
|
|
+ a.z() = (*this)(2, 0);
|
|
|
+ b.x() = (*this)(0, 1);
|
|
|
+ b.y() = (*this)(1, 1);
|
|
|
+ b.z() = (*this)(2, 1);
|
|
|
+ c.x() = (*this)(0, 2);
|
|
|
+ c.y() = (*this)(1, 2);
|
|
|
+ c.z() = (*this)(2, 2);
|
|
|
}
|
|
|
|
|
|
// setRow
|
|
|
inline void Mat3::setRow(const uint i, const Vec3& v)
|
|
|
{
|
|
|
- SELF(i, 0) = v.x();
|
|
|
- SELF(i, 1) = v.y();
|
|
|
- SELF(i, 2) = v.z();
|
|
|
+ (*this)(i, 0) = v.x();
|
|
|
+ (*this)(i, 1) = v.y();
|
|
|
+ (*this)(i, 2) = v.z();
|
|
|
}
|
|
|
|
|
|
// getRow
|
|
|
inline Vec3 Mat3::getRow(const uint i) const
|
|
|
{
|
|
|
- return Vec3(SELF(i, 0), SELF(i, 1), SELF(i, 2));
|
|
|
+ return Vec3((*this)(i, 0), (*this)(i, 1), (*this)(i, 2));
|
|
|
}
|
|
|
|
|
|
// setColumn
|
|
|
inline void Mat3::setColumn(const uint i, const Vec3& v)
|
|
|
{
|
|
|
- SELF(0, i) = v.x();
|
|
|
- SELF(1, i) = v.y();
|
|
|
- SELF(2, i) = v.z();
|
|
|
+ (*this)(0, i) = v.x();
|
|
|
+ (*this)(1, i) = v.y();
|
|
|
+ (*this)(2, i) = v.z();
|
|
|
}
|
|
|
|
|
|
// getColumn
|
|
|
inline Vec3 Mat3::getColumn(const uint i) const
|
|
|
{
|
|
|
- return Vec3(SELF(0,i), SELF(1,i), SELF(2,i));
|
|
|
+ return Vec3((*this)(0,i), (*this)(1,i), (*this)(2,i));
|
|
|
}
|
|
|
|
|
|
// getXAxis
|
|
|
@@ -547,15 +544,15 @@ inline void Mat3::setRotationX(float rad)
|
|
|
float sintheta, costheta;
|
|
|
sinCos(rad, sintheta, costheta);
|
|
|
|
|
|
- SELF(0, 0) = 1.0;
|
|
|
- SELF(0, 1) = 0.0;
|
|
|
- SELF(0, 2) = 0.0;
|
|
|
- SELF(1, 0) = 0.0;
|
|
|
- SELF(1, 1) = costheta;
|
|
|
- SELF(1, 2) = -sintheta;
|
|
|
- SELF(2, 0) = 0.0;
|
|
|
- SELF(2, 1) = sintheta;
|
|
|
- SELF(2, 2) = costheta;
|
|
|
+ (*this)(0, 0) = 1.0;
|
|
|
+ (*this)(0, 1) = 0.0;
|
|
|
+ (*this)(0, 2) = 0.0;
|
|
|
+ (*this)(1, 0) = 0.0;
|
|
|
+ (*this)(1, 1) = costheta;
|
|
|
+ (*this)(1, 2) = -sintheta;
|
|
|
+ (*this)(2, 0) = 0.0;
|
|
|
+ (*this)(2, 1) = sintheta;
|
|
|
+ (*this)(2, 2) = costheta;
|
|
|
}
|
|
|
|
|
|
// setRotationY
|
|
|
@@ -564,15 +561,15 @@ inline void Mat3::setRotationY(float rad)
|
|
|
float sintheta, costheta;
|
|
|
sinCos(rad, sintheta, costheta);
|
|
|
|
|
|
- SELF(0, 0) = costheta;
|
|
|
- SELF(0, 1) = 0.0;
|
|
|
- SELF(0, 2) = sintheta;
|
|
|
- SELF(1, 0) = 0.0;
|
|
|
- SELF(1, 1) = 1.0;
|
|
|
- SELF(1, 2) = 0.0;
|
|
|
- SELF(2, 0) = -sintheta;
|
|
|
- SELF(2, 1) = 0.0;
|
|
|
- SELF(2, 2) = costheta;
|
|
|
+ (*this)(0, 0) = costheta;
|
|
|
+ (*this)(0, 1) = 0.0;
|
|
|
+ (*this)(0, 2) = sintheta;
|
|
|
+ (*this)(1, 0) = 0.0;
|
|
|
+ (*this)(1, 1) = 1.0;
|
|
|
+ (*this)(1, 2) = 0.0;
|
|
|
+ (*this)(2, 0) = -sintheta;
|
|
|
+ (*this)(2, 1) = 0.0;
|
|
|
+ (*this)(2, 2) = costheta;
|
|
|
}
|
|
|
|
|
|
// loadRotationZ
|
|
|
@@ -581,15 +578,15 @@ inline void Mat3::setRotationZ(float rad)
|
|
|
float sintheta, costheta;
|
|
|
sinCos(rad, sintheta, costheta);
|
|
|
|
|
|
- SELF(0, 0) = costheta;
|
|
|
- SELF(0, 1) = -sintheta;
|
|
|
- SELF(0, 2) = 0.0;
|
|
|
- SELF(1, 0) = sintheta;
|
|
|
- SELF(1, 1) = costheta;
|
|
|
- SELF(1, 2) = 0.0;
|
|
|
- SELF(2, 0) = 0.0;
|
|
|
- SELF(2, 1) = 0.0;
|
|
|
- SELF(2, 2) = 1.0;
|
|
|
+ (*this)(0, 0) = costheta;
|
|
|
+ (*this)(0, 1) = -sintheta;
|
|
|
+ (*this)(0, 2) = 0.0;
|
|
|
+ (*this)(1, 0) = sintheta;
|
|
|
+ (*this)(1, 1) = costheta;
|
|
|
+ (*this)(1, 2) = 0.0;
|
|
|
+ (*this)(2, 0) = 0.0;
|
|
|
+ (*this)(2, 1) = 0.0;
|
|
|
+ (*this)(2, 2) = 1.0;
|
|
|
}
|
|
|
|
|
|
// rotateXAxis
|
|
|
@@ -609,28 +606,32 @@ inline void Mat3::rotateXAxis(float rad)
|
|
|
getColumns(xAxis, yAxis, zAxis);*/
|
|
|
|
|
|
// zAxis = zAxis*cosa - yAxis*sina;
|
|
|
- SELF(0, 2) = SELF(0, 2) * cosa - SELF(0, 1) * sina;
|
|
|
- SELF(1, 2) = SELF(1, 2) * cosa - SELF(1, 1) * sina;
|
|
|
- SELF(2, 2) = SELF(2, 2) * cosa - SELF(2, 1) * sina;
|
|
|
+ (*this)(0, 2) = (*this)(0, 2) * cosa - (*this)(0, 1) * sina;
|
|
|
+ (*this)(1, 2) = (*this)(1, 2) * cosa - (*this)(1, 1) * sina;
|
|
|
+ (*this)(2, 2) = (*this)(2, 2) * cosa - (*this)(2, 1) * sina;
|
|
|
|
|
|
// zAxis.normalize();
|
|
|
- float len = sqrt(SELF(0, 2) * SELF(0, 2) + SELF(1, 2) * SELF(1, 2) +
|
|
|
- SELF(2, 2) * SELF(2, 2));
|
|
|
- SELF(0, 2) /= len;
|
|
|
- SELF(1, 2) /= len;
|
|
|
- SELF(2, 2) /= len;
|
|
|
+ float len = sqrt((*this)(0, 2) * (*this)(0, 2) +
|
|
|
+ (*this)(1, 2) * (*this)(1, 2) + (*this)(2, 2) * (*this)(2, 2));
|
|
|
+ (*this)(0, 2) /= len;
|
|
|
+ (*this)(1, 2) /= len;
|
|
|
+ (*this)(2, 2) /= len;
|
|
|
|
|
|
// yAxis = zAxis * xAxis;
|
|
|
- SELF(0, 1) = SELF(1, 2) * SELF(2, 0) - SELF(2, 2) * SELF(1, 0);
|
|
|
- SELF(1, 1) = SELF(2, 2) * SELF(0, 0) - SELF(0, 2) * SELF(2, 0);
|
|
|
- SELF(2, 1) = SELF(0, 2) * SELF(1, 0) - SELF(1, 2) * SELF(0, 0);
|
|
|
+ (*this)(0, 1) = (*this)(1, 2) * (*this)(2, 0) -
|
|
|
+ (*this)(2, 2) * (*this)(1, 0);
|
|
|
+ (*this)(1, 1) = (*this)(2, 2) * (*this)(0, 0) -
|
|
|
+ (*this)(0, 2) * (*this)(2, 0);
|
|
|
+ (*this)(2, 1) = (*this)(0, 2) * (*this)(1, 0) -
|
|
|
+ (*this)(1, 2) * (*this)(0, 0);
|
|
|
|
|
|
// yAxis.normalize();
|
|
|
- /*len = invSqrt(SELF(0, 1) * SELF(0, 1) + SELF(1, 1) * SELF(1, 1) +
|
|
|
- SELF(2, 1) * SELF(2, 1));
|
|
|
- SELF(0, 1) *= len;
|
|
|
- SELF(1, 1) *= len;
|
|
|
- SELF(2, 1) *= len;*/
|
|
|
+ /*len = invSqrt((*this)(0, 1) * (*this)(0, 1) +
|
|
|
+ (*this)(1, 1) * (*this)(1, 1) +
|
|
|
+ (*this)(2, 1) * (*this)(2, 1));
|
|
|
+ (*this)(0, 1) *= len;
|
|
|
+ (*this)(1, 1) *= len;
|
|
|
+ (*this)(2, 1) *= len;*/
|
|
|
|
|
|
// setColumns(xAxis, yAxis, zAxis);
|
|
|
|
|
|
@@ -646,28 +647,31 @@ inline void Mat3::rotateYAxis(float rad)
|
|
|
getColumns(xAxis, yAxis, zAxis);*/
|
|
|
|
|
|
// zAxis = zAxis*cosa + xAxis*sina;
|
|
|
- SELF(0, 2) = SELF(0, 2)*cosa + SELF(0, 0)*sina;
|
|
|
- SELF(1, 2) = SELF(1, 2)*cosa + SELF(1, 0)*sina;
|
|
|
- SELF(2, 2) = SELF(2, 2)*cosa + SELF(2, 0)*sina;
|
|
|
+ (*this)(0, 2) = (*this)(0, 2)*cosa + (*this)(0, 0)*sina;
|
|
|
+ (*this)(1, 2) = (*this)(1, 2)*cosa + (*this)(1, 0)*sina;
|
|
|
+ (*this)(2, 2) = (*this)(2, 2)*cosa + (*this)(2, 0)*sina;
|
|
|
|
|
|
// zAxis.normalize();
|
|
|
- float len = sqrt(SELF(0, 2) * SELF(0, 2) + SELF(1, 2) * SELF(1, 2) +
|
|
|
- SELF(2, 2) * SELF(2, 2));
|
|
|
- SELF(0, 2) /= len;
|
|
|
- SELF(1, 2) /= len;
|
|
|
- SELF(2, 2) /= len;
|
|
|
+ float len = sqrt((*this)(0, 2) * (*this)(0, 2) +
|
|
|
+ (*this)(1, 2) * (*this)(1, 2) + (*this)(2, 2) * (*this)(2, 2));
|
|
|
+ (*this)(0, 2) /= len;
|
|
|
+ (*this)(1, 2) /= len;
|
|
|
+ (*this)(2, 2) /= len;
|
|
|
|
|
|
// xAxis = (zAxis*yAxis) * -1.0f;
|
|
|
- SELF(0, 0) = SELF(2, 2) * SELF(1, 1) - SELF(1, 2) * SELF(2, 1);
|
|
|
- SELF(1, 0) = SELF(0, 2) * SELF(2, 1) - SELF(2, 2) * SELF(0, 1);
|
|
|
- SELF(2, 0) = SELF(1, 2) * SELF(0, 1) - SELF(0, 2) * SELF(1, 1);
|
|
|
+ (*this)(0, 0) = (*this)(2, 2) * (*this)(1, 1) -
|
|
|
+ (*this)(1, 2) * (*this)(2, 1);
|
|
|
+ (*this)(1, 0) = (*this)(0, 2) * (*this)(2, 1) -
|
|
|
+ (*this)(2, 2) * (*this)(0, 1);
|
|
|
+ (*this)(2, 0) = (*this)(1, 2) * (*this)(0, 1) -
|
|
|
+ (*this)(0, 2) * (*this)(1, 1);
|
|
|
|
|
|
// xAxis.normalize();
|
|
|
- /*len = invSqrt(SELF(0, 0) * SELF(0, 0) + SELF(1, 0) * SELF(1, 0) +
|
|
|
- SELF(2, 0) * SELF(2, 0));
|
|
|
- SELF(0, 0) *= len;
|
|
|
- SELF(1, 0) *= len;
|
|
|
- SELF(2, 0) *= len;*/
|
|
|
+ /*len = invSqrt((*this)(0, 0) * (*this)(0, 0) + (*this)(1, 0) *
|
|
|
+ (*this)(1, 0) + (*this)(2, 0) * (*this)(2, 0));
|
|
|
+ (*this)(0, 0) *= len;
|
|
|
+ (*this)(1, 0) *= len;
|
|
|
+ (*this)(2, 0) *= len;*/
|
|
|
|
|
|
// setColumns(xAxis, yAxis, zAxis);
|
|
|
}
|
|
|
@@ -683,28 +687,31 @@ inline void Mat3::rotateZAxis(float rad)
|
|
|
getColumns(xAxis, yAxis, zAxis);*/
|
|
|
|
|
|
// xAxis = xAxis*cosa + yAxis*sina;
|
|
|
- SELF(0, 0) = SELF(0, 0)*cosa + SELF(0, 1)*sina;
|
|
|
- SELF(1, 0) = SELF(1, 0)*cosa + SELF(1, 1)*sina;
|
|
|
- SELF(2, 0) = SELF(2, 0)*cosa + SELF(2, 1)*sina;
|
|
|
+ (*this)(0, 0) = (*this)(0, 0)*cosa + (*this)(0, 1)*sina;
|
|
|
+ (*this)(1, 0) = (*this)(1, 0)*cosa + (*this)(1, 1)*sina;
|
|
|
+ (*this)(2, 0) = (*this)(2, 0)*cosa + (*this)(2, 1)*sina;
|
|
|
|
|
|
// xAxis.normalize();
|
|
|
- float len = sqrt(SELF(0, 0) * SELF(0, 0) + SELF(1, 0) * SELF(1, 0) +
|
|
|
- SELF(2, 0) * SELF(2, 0));
|
|
|
- SELF(0, 0) /= len;
|
|
|
- SELF(1, 0) /= len;
|
|
|
- SELF(2, 0) /= len;
|
|
|
+ float len = sqrt((*this)(0, 0) * (*this)(0, 0) +
|
|
|
+ (*this)(1, 0) * (*this)(1, 0) + (*this)(2, 0) * (*this)(2, 0));
|
|
|
+ (*this)(0, 0) /= len;
|
|
|
+ (*this)(1, 0) /= len;
|
|
|
+ (*this)(2, 0) /= len;
|
|
|
|
|
|
// yAxis = zAxis*xAxis;
|
|
|
- SELF(0, 1) = SELF(1, 2) * SELF(2, 0) - SELF(2, 2) * SELF(1, 0);
|
|
|
- SELF(1, 1) = SELF(2, 2) * SELF(0, 0) - SELF(0, 2) * SELF(2, 0);
|
|
|
- SELF(2, 1) = SELF(0, 2) * SELF(1, 0) - SELF(1, 2) * SELF(0, 0);
|
|
|
+ (*this)(0, 1) = (*this)(1, 2) * (*this)(2, 0) -
|
|
|
+ (*this)(2, 2) * (*this)(1, 0);
|
|
|
+ (*this)(1, 1) = (*this)(2, 2) * (*this)(0, 0) -
|
|
|
+ (*this)(0, 2) * (*this)(2, 0);
|
|
|
+ (*this)(2, 1) = (*this)(0, 2) * (*this)(1, 0) -
|
|
|
+ (*this)(1, 2) * (*this)(0, 0);
|
|
|
|
|
|
// yAxis.normalize();
|
|
|
- /*len = invSqrt(SELF(0, 1) * SELF(0, 1) + SELF(1, 1) * SELF(1, 1) +
|
|
|
- SELF(2, 1) * SELF(2, 1));
|
|
|
- SELF(0, 1) *= len;
|
|
|
- SELF(1, 1) *= len;
|
|
|
- SELF(2, 1) *= len;*/
|
|
|
+ /*len = invSqrt((*this)(0, 1) * (*this)(0, 1) +
|
|
|
+ (*this)(1, 1) * (*this)(1, 1) + (*this)(2, 1) * (*this)(2, 1));
|
|
|
+ (*this)(0, 1) *= len;
|
|
|
+ (*this)(1, 1) *= len;
|
|
|
+ (*this)(2, 1) *= len;*/
|
|
|
|
|
|
//setColumns(xAxis, yAxis, zAxis);
|
|
|
}
|
|
|
@@ -712,30 +719,30 @@ inline void Mat3::rotateZAxis(float rad)
|
|
|
// transpose
|
|
|
inline void Mat3::transpose()
|
|
|
{
|
|
|
- float temp = SELF(0, 1);
|
|
|
- SELF(0, 1) = SELF(1, 0);
|
|
|
- SELF(1, 0) = temp;
|
|
|
- temp = SELF(0, 2);
|
|
|
- SELF(0, 2) = SELF(2, 0);
|
|
|
- SELF(2, 0) = temp;
|
|
|
- temp = SELF(1, 2);
|
|
|
- SELF(1, 2) = SELF(2, 1);
|
|
|
- SELF(2, 1) = temp;
|
|
|
+ float temp = (*this)(0, 1);
|
|
|
+ (*this)(0, 1) = (*this)(1, 0);
|
|
|
+ (*this)(1, 0) = temp;
|
|
|
+ temp = (*this)(0, 2);
|
|
|
+ (*this)(0, 2) = (*this)(2, 0);
|
|
|
+ (*this)(2, 0) = temp;
|
|
|
+ temp = (*this)(1, 2);
|
|
|
+ (*this)(1, 2) = (*this)(2, 1);
|
|
|
+ (*this)(2, 1) = temp;
|
|
|
}
|
|
|
|
|
|
// transposed
|
|
|
inline Mat3 Mat3::getTransposed() const
|
|
|
{
|
|
|
Mat3 m3;
|
|
|
- m3[0] = SELF[0];
|
|
|
- m3[1] = SELF[3];
|
|
|
- m3[2] = SELF[6];
|
|
|
- m3[3] = SELF[1];
|
|
|
- m3[4] = SELF[4];
|
|
|
- m3[5] = SELF[7];
|
|
|
- m3[6] = SELF[2];
|
|
|
- m3[7] = SELF[5];
|
|
|
- m3[8] = SELF[8];
|
|
|
+ m3[0] = (*this)[0];
|
|
|
+ m3[1] = (*this)[3];
|
|
|
+ m3[2] = (*this)[6];
|
|
|
+ m3[3] = (*this)[1];
|
|
|
+ m3[4] = (*this)[4];
|
|
|
+ m3[5] = (*this)[7];
|
|
|
+ m3[6] = (*this)[2];
|
|
|
+ m3[7] = (*this)[5];
|
|
|
+ m3[8] = (*this)[8];
|
|
|
return m3;
|
|
|
}
|
|
|
|
|
|
@@ -746,10 +753,10 @@ inline void Mat3::reorthogonalize()
|
|
|
/*Mat3 correction_m3 =
|
|
|
(
|
|
|
(Mat3::ident * 3.0f) -
|
|
|
- (SELF * SELF.transposed())
|
|
|
+ ((*this) * (*this).transposed())
|
|
|
) * 0.5f;
|
|
|
|
|
|
- SELF = correction_m3 * SELF;*/
|
|
|
+ (*this) = correction_m3 * (*this);*/
|
|
|
|
|
|
// method 2: Gram-Schmidt method with a twist for zAxis
|
|
|
Vec3 xAxis, yAxis, zAxis;
|
|
|
@@ -769,13 +776,15 @@ inline void Mat3::reorthogonalize()
|
|
|
inline float Mat3::getDet() const
|
|
|
{
|
|
|
/* Accurate method:
|
|
|
- return SELF(0, 0) * SELF(1, 1) * SELF(2, 2) + SELF(0, 1) * SELF(1, 2) *
|
|
|
- SELF(2, 0) + SELF(0, 2) * SELF(1, 0) * SELF(2, 1) -
|
|
|
- SELF(0, 0) * SELF(1, 2) * SELF(2, 1) - SELF(0, 1) * SELF(1, 0) *
|
|
|
- SELF(2, 2) - SELF(0, 2) * SELF(1, 1) * SELF(2, 0); */
|
|
|
- return SELF(0, 0)*(SELF(1, 1) * SELF(2, 2) - SELF(1, 2) * SELF(2, 1)) -
|
|
|
- SELF(0, 1)*(SELF(1, 0) * SELF(2, 2) - SELF(1, 2) * SELF(2, 0)) +
|
|
|
- SELF(0, 2)*(SELF(0, 1) * SELF(2, 1) - SELF(1, 1) * SELF(2, 0));
|
|
|
+ return (*this)(0, 0) * (*this)(1, 1) * (*this)(2, 2) +
|
|
|
+ (*this)(0, 1) * (*this)(1, 2) * (*this)(2, 0) + (*this)(0, 2) *
|
|
|
+ (*this)(1, 0) * (*this)(2, 1) - (*this)(0, 0) * (*this)(1, 2) *
|
|
|
+ (*this)(2, 1) - (*this)(0, 1) * (*this)(1, 0) *
|
|
|
+ (*this)(2, 2) - (*this)(0, 2) * (*this)(1, 1) * (*this)(2, 0); */
|
|
|
+ return (*this)(0, 0) * ((*this)(1, 1) * (*this)(2, 2) -
|
|
|
+ (*this)(1, 2) * (*this)(2, 1)) - (*this)(0, 1) * ((*this)(1, 0) *
|
|
|
+ (*this)(2, 2) - (*this)(1, 2) * (*this)(2, 0)) + (*this)(0, 2) *
|
|
|
+ ((*this)(0, 1) * (*this)(2, 1) - (*this)(1, 1) * (*this)(2, 0));
|
|
|
}
|
|
|
|
|
|
// getInverse
|
|
|
@@ -785,10 +794,14 @@ inline Mat3 Mat3::getInverse() const
|
|
|
Mat3 r;
|
|
|
|
|
|
// compute determinant
|
|
|
- float cofactor0 = SELF(1, 1) * SELF(2, 2) - SELF(1, 2) * SELF(2, 1);
|
|
|
- float cofactor3 = SELF(0, 2) * SELF(2, 1) - SELF(0, 1) * SELF(2, 2);
|
|
|
- float cofactor6 = SELF(0, 1) * SELF(1, 2) - SELF(0, 2) * SELF(1, 1);
|
|
|
- float det = SELF(0, 0) * cofactor0 + SELF(1, 0) * cofactor3 + SELF(2, 0) *
|
|
|
+ float cofactor0 = (*this)(1, 1) * (*this)(2, 2) -
|
|
|
+ (*this)(1, 2) * (*this)(2, 1);
|
|
|
+ float cofactor3 = (*this)(0, 2) * (*this)(2, 1) -
|
|
|
+ (*this)(0, 1) * (*this)(2, 2);
|
|
|
+ float cofactor6 = (*this)(0, 1) * (*this)(1, 2) -
|
|
|
+ (*this)(0, 2) * (*this)(1, 1);
|
|
|
+ float det = (*this)(0, 0) * cofactor0 + (*this)(1, 0) * cofactor3 +
|
|
|
+ (*this)(2, 0) *
|
|
|
cofactor6;
|
|
|
|
|
|
ASSERT(!isZero(det)); // Cannot invert det == 0
|
|
|
@@ -799,13 +812,19 @@ inline Mat3 Mat3::getInverse() const
|
|
|
r(0, 1) = invDet * cofactor3;
|
|
|
r(0, 2) = invDet * cofactor6;
|
|
|
|
|
|
- r(1, 0) = invDet * (SELF(1, 2) * SELF(2, 0) - SELF(1, 0) * SELF(2, 2));
|
|
|
- r(1, 1) = invDet * (SELF(0, 0) * SELF(2, 2) - SELF(0, 2) * SELF(2, 0));
|
|
|
- r(1, 2) = invDet * (SELF(0, 2) * SELF(1, 0) - SELF(0, 0) * SELF(1, 2));
|
|
|
+ r(1, 0) = invDet * ((*this)(1, 2) * (*this)(2, 0) -
|
|
|
+ (*this)(1, 0) * (*this)(2, 2));
|
|
|
+ r(1, 1) = invDet * ((*this)(0, 0) * (*this)(2, 2) -
|
|
|
+ (*this)(0, 2) * (*this)(2, 0));
|
|
|
+ r(1, 2) = invDet * ((*this)(0, 2) * (*this)(1, 0) -
|
|
|
+ (*this)(0, 0) * (*this)(1, 2));
|
|
|
|
|
|
- r(2, 0) = invDet * (SELF(1, 0) * SELF(2, 1) - SELF(1, 1) * SELF(2, 0));
|
|
|
- r(2, 1) = invDet * (SELF(0, 1) * SELF(2, 0) - SELF(0, 0) * SELF(2, 1));
|
|
|
- r(2, 2) = invDet * (SELF(0, 0) * SELF(1, 1) - SELF(0, 1) * SELF(1, 0));
|
|
|
+ r(2, 0) = invDet * ((*this)(1, 0) * (*this)(2, 1) -
|
|
|
+ (*this)(1, 1) * (*this)(2, 0));
|
|
|
+ r(2, 1) = invDet * ((*this)(0, 1) * (*this)(2, 0) -
|
|
|
+ (*this)(0, 0) * (*this)(2, 1));
|
|
|
+ r(2, 2) = invDet * ((*this)(0, 0) * (*this)(1, 1) -
|
|
|
+ (*this)(0, 1) * (*this)(1, 0));
|
|
|
|
|
|
return r;
|
|
|
}
|
|
|
@@ -813,14 +832,14 @@ inline Mat3 Mat3::getInverse() const
|
|
|
// setIdentity
|
|
|
inline void Mat3::setIdentity()
|
|
|
{
|
|
|
- SELF = getIdentity();
|
|
|
+ (*this) = getIdentity();
|
|
|
}
|
|
|
|
|
|
// invert
|
|
|
// see above
|
|
|
inline void Mat3::invert()
|
|
|
{
|
|
|
- SELF = getInverse();
|
|
|
+ (*this) = getInverse();
|
|
|
}
|
|
|
|
|
|
// getZero
|
|
|
@@ -843,10 +862,14 @@ inline std::ostream& operator<<(std::ostream& s, const Mat3& m)
|
|
|
for(int i=0; i<3; i++)
|
|
|
{
|
|
|
for(int j=0; j<3; j++)
|
|
|
+ {
|
|
|
s << m(i, j) << ' ';
|
|
|
+ }
|
|
|
|
|
|
if(i != 2)
|
|
|
+ {
|
|
|
s << "\n";
|
|
|
+ }
|
|
|
}
|
|
|
return s;
|
|
|
}
|