minor corrections to the operator *= and constructor so that matrix can be more easily created from vector objects

git-svn-id: https://arducopter.googlecode.com/svn/trunk@540 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
rmackay9@yahoo.com 2010-09-23 03:14:15 +00:00
parent 34aa823003
commit b3e1b6c57d

View File

@ -78,11 +78,11 @@ public:
// uniform scaling // uniform scaling
Matrix3<T> operator * (const T num) const Matrix3<T> operator * (const T num) const
{ return Matrix3<T>(a*num, b*num, c*num); } { return Matrix3<T>(a*num, b*num, c*num); }
Matrix3<T> operator *= (const T num) Matrix3<T> &operator *= (const T num)
{ return *this = *this * num; } { return *this = *this * num; }
Matrix3<T> operator / (const T num) const Matrix3<T> operator / (const T num) const
{ return Matrix3<T>(a/num, b/num, c/num); } { return Matrix3<T>(a/num, b/num, c/num); }
Matrix3<T> operator /= (const T num) Matrix3<T> &operator /= (const T num)
{ return *this = *this / num; } { return *this = *this / num; }
// multiplication by a vector // multiplication by a vector
@ -107,8 +107,8 @@ public:
c.x * m.a.z + c.y * m.b.z + c.z * m.c.z)); c.x * m.a.z + c.y * m.b.z + c.z * m.c.z));
return temp; return temp;
} }
Matrix3<T> operator *=(const Matrix3<T> &m) Matrix3<T> &operator *=(const Matrix3<T> &m)
{ return *this = this * m; } { return *this = *this * m; }
// transpose the matrix // transpose the matrix
Matrix3<T> transposed(void) Matrix3<T> transposed(void)
@ -126,7 +126,7 @@ public:
/* trivial ctor */ \ /* trivial ctor */ \
name() {} \ name() {} \
/* make a,b,c combination into a matrix */ \ /* make a,b,c combination into a matrix */ \
name(Vector3<type> &a0, Vector3<type> &b0, Vector3<type> &c0) : Matrix3<type>(a0, b0, c0) {} name(const Vector3<type> &a0, const Vector3<type> &b0, const Vector3<type> &c0) : Matrix3<type>(a0, b0, c0) {}
class Matrix3i : public Matrix3<int> class Matrix3i : public Matrix3<int>
{ {