#include <vecmath.h>
Public Member Functions | |
Matrix3 () | |
Matrix3 (const Vector3 &row0, const Vector3 &row1, const Vector3 &row2) | |
Matrix3 (const Matrix3 &m) | |
Matrix3 & | operator= (const Matrix3 &m) |
int | index (int row, int col) const |
const double & | operator() (int row, int col) const |
double & | operator() (int row, int col) |
Vector3 | row (int r) const |
Vector3 | column (int c) const |
Matrix3 | transpose () const |
Matrix3 | operator+ (const Matrix3 &m) const |
Matrix3 & | operator *= (double s) |
Vector3 | operator * (const Vector3 &v) const |
Point3 | operator * (const Point3 &p) const |
Matrix3 | operator * (const Matrix3 &m) const |
double | determinant () const |
Matrix3 | inverse () const |
bool | operator== (const Matrix3 &m) const |
bool | approxEqual (const Matrix3 &m, double eps=1e-12) const |
void | print () const |
Static Public Member Functions | |
static Matrix3 | identity () |
static Matrix3 | rotationXYZtoUVW (Vector3 u, Vector3 v, Vector3 w) |
static double | det2x2 (double a, double b, double c, double d) |
Private Attributes | |
double | mat [9] |
Definition at line 417 of file vecmath.h.
EMAN::Matrix3::Matrix3 | ( | ) | [inline] |
Definition at line 419 of file vecmath.h.
Referenced by identity(), inverse(), and rotationXYZtoUVW().
00419 { 00420 for ( int i = 0; i < 3; i++ ) 00421 for ( int j = 0; j < 3; j++ ) 00422 mat[ index(i,j) ] = (i == j) ? 1.0 : 0.0; 00423 }
EMAN::Matrix3::Matrix3 | ( | const Matrix3 & | m | ) | [inline] |
bool EMAN::Matrix3::approxEqual | ( | const Matrix3 & | m, | |
double | eps = 1e-12 | |||
) | const [inline] |
Vector3 EMAN::Matrix3::column | ( | int | c | ) | const [inline] |
static double EMAN::Matrix3::det2x2 | ( | double | a, | |
double | b, | |||
double | c, | |||
double | d | |||
) | [inline, static] |
double EMAN::Matrix3::determinant | ( | ) | const [inline] |
Definition at line 519 of file vecmath.h.
Referenced by inverse().
00519 { 00520 return ((*this)(0,0) * (*this)(1,1) * (*this)(2,2) + 00521 (*this)(0,1) * (*this)(1,2) * (*this)(2,0) + 00522 (*this)(0,2) * (*this)(1,0) * (*this)(2,1) - 00523 (*this)(0,2) * (*this)(1,1) * (*this)(2,0) - 00524 (*this)(0,0) * (*this)(1,2) * (*this)(2,1) - 00525 (*this)(0,1) * (*this)(1,0) * (*this)(2,2)); 00526 }
static Matrix3 EMAN::Matrix3::identity | ( | ) | [inline, static] |
int EMAN::Matrix3::index | ( | int | row, | |
int | col | |||
) | const [inline] |
Matrix3 EMAN::Matrix3::inverse | ( | ) | const [inline] |
Definition at line 528 of file vecmath.h.
References Assert, det2x2(), determinant(), EMAN::isZero(), and Matrix3().
00528 { 00529 Matrix3 adjoint = Matrix3( Vector3( det2x2((*this)(1,1), (*this)(1,2), (*this)(2,1), (*this)(2,2)), 00530 -det2x2((*this)(1,0), (*this)(1,2), (*this)(2,0), (*this)(2,2)), 00531 det2x2((*this)(1,0), (*this)(1,1), (*this)(2,0), (*this)(2,1)) ), 00532 Vector3( -det2x2((*this)(0,1), (*this)(0,2), (*this)(2,1), (*this)(2,2)), 00533 det2x2((*this)(0,0), (*this)(0,2), (*this)(2,0), (*this)(2,2)), 00534 -det2x2((*this)(0,0), (*this)(0,1), (*this)(2,0), (*this)(2,1)) ), 00535 Vector3( det2x2((*this)(0,1), (*this)(0,2), (*this)(1,1), (*this)(1,2)), 00536 -det2x2((*this)(0,0), (*this)(0,2), (*this)(1,0), (*this)(1,2)), 00537 det2x2((*this)(0,0), (*this)(0,1), (*this)(1,0), (*this)(1,1)) ) ); 00538 const double dDet = determinant(); 00539 00540 Assert( isZero( dDet ) == false ); 00541 adjoint *= 1.0 / dDet; 00542 00543 return adjoint; 00544 }
Matrix3& EMAN::Matrix3::operator *= | ( | double | s | ) | [inline] |
double& EMAN::Matrix3::operator() | ( | int | row, | |
int | col | |||
) | [inline] |
const double& EMAN::Matrix3::operator() | ( | int | row, | |
int | col | |||
) | const [inline] |
bool EMAN::Matrix3::operator== | ( | const Matrix3 & | m | ) | const [inline] |
void EMAN::Matrix3::print | ( | ) | const [inline] |
Definition at line 560 of file vecmath.h.
00560 { 00561 std::cout << "( " << (*this)(0,0) << ", " << (*this)(0,1) << ", " << (*this)(0,2) << "\n"; 00562 std::cout << " " << (*this)(1,0) << ", " << (*this)(1,1) << ", " << (*this)(1,2) << "\n"; 00563 std::cout << " " << (*this)(2,0) << ", " << (*this)(2,1) << ", " << (*this)(2,2) << ")\n"; 00564 }
Vector3 EMAN::Matrix3::row | ( | int | r | ) | const [inline] |
Matrix3 EMAN::Matrix3::transpose | ( | ) | const [inline] |
double EMAN::Matrix3::mat[9] [private] |
Definition at line 567 of file vecmath.h.
Referenced by approxEqual(), column(), Matrix3(), operator *=(), operator()(), operator+(), operator=(), operator==(), and row().