--- trunk/src/math/SquareMatrix3.hpp 2005/04/15 22:04:00 507 +++ trunk/src/math/SquareMatrix3.hpp 2006/02/22 20:35:16 891 @@ -166,8 +166,28 @@ namespace oopse { void setupRotMat(Real w, Real x, Real y, Real z) { Quaternion q(w, x, y, z); *this = q.toRotationMatrix3(); + } + + void setupSkewMat(Vector3 v) { + setupSkewMat(v[0], v[1], v[2]); + } + + void setupSkewMat(Real v1, Real v2, Real v3) { + this->data_[0][0] = 0; + this->data_[0][1] = -v3; + this->data_[0][2] = v2; + this->data_[1][0] = v3; + this->data_[1][1] = 0; + this->data_[1][2] = -v1; + this->data_[2][0] = -v2; + this->data_[2][1] = v1; + this->data_[2][2] = 0; + + } + + /** * Returns the quaternion from this rotation matrix * @return the quaternion from this rotation matrix @@ -188,9 +208,9 @@ namespace oopse { q[3] = (this->data_[0][1] - this->data_[1][0]) * s; } else { - ad1 = fabs( this->data_[0][0] ); - ad2 = fabs( this->data_[1][1] ); - ad3 = fabs( this->data_[2][2] ); + ad1 = this->data_[0][0]; + ad2 = this->data_[1][1]; + ad3 = this->data_[2][2]; if( ad1 >= ad2 && ad1 >= ad3 ){ @@ -316,6 +336,16 @@ namespace oopse { m /= det; return m; + } + + SquareMatrix3 transpose() const{ + SquareMatrix3 result; + + for (unsigned int i = 0; i < 3; i++) + for (unsigned int j = 0; j < 3; j++) + result(j, i) = this->data_[i][j]; + + return result; } /** * Extract the eigenvalues and eigenvectors from a 3x3 matrix.