#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 | |
Matrix3 | identity () |
Matrix3 | rotationXYZtoUVW (Vector3 u, Vector3 v, Vector3 w) |
double | det2x2 (double a, double b, double c, double d) |
Private Attributes | |
double | mat [9] |
|
Definition at line 419 of file vecmath.h. 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 }
|
|
Definition at line 425 of file vecmath.h. 00425 { 00426 for ( int i = 0; i < 3; i++ ) { 00427 mat[ index( 0, i ) ] = row0[i]; 00428 mat[ index( 1, i ) ] = row1[i]; 00429 mat[ index( 2, i ) ] = row2[i]; 00430 } 00431 }
|
|
Definition at line 433 of file vecmath.h. 00433 { 00434 (*this) = m; 00435 }
|
|
Definition at line 553 of file vecmath.h. References EMAN::isZero(), and mat. 00553 { 00554 for ( int i = 0; i < 9; i++ ) 00555 if ( isZero( mat[i] - m.mat[i], eps ) ) 00556 return false; 00557 return true; 00558 }
|
|
Definition at line 452 of file vecmath.h.
|
|
Definition at line 515 of file vecmath.h. References b. 00515 { 00516 return a * d - b * c; 00517 }
|
|
Definition at line 519 of file vecmath.h. 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 }
|
|
Definition at line 503 of file vecmath.h. 00503 { 00504 return Matrix3(Vector3(1, 0, 0), 00505 Vector3(0, 1, 0), 00506 Vector3(0, 0, 1)); 00507 }
|
|
Definition at line 443 of file vecmath.h. References Assert. 00443 { Assert( row >= 0 && row < 3 ); Assert( col >= 0 && col < 3 ); return col * 3 + row; }
|
|
Definition at line 528 of file vecmath.h. References Assert, and EMAN::isZero(). 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 }
|
|
Definition at line 491 of file vecmath.h. 00491 { 00492 Matrix3 matRet; 00493 for ( int i = 0; i < 3; i++ ) { 00494 for ( int j = 0; j < 3; j++ ) { 00495 matRet(i,j) = 0.0; 00496 for ( int k = 0; k < 3; k++ ) 00497 matRet(i,j) += (*this)(i,k) * m(k,j); 00498 } 00499 } 00500 return matRet; 00501 }
|
|
Definition at line 485 of file vecmath.h. 00485 { 00486 return Point3((*this)(0,0) * p[0] + (*this)(0,1) * p[1] + (*this)(0,2) * p[2], 00487 (*this)(1,0) * p[0] + (*this)(1,1) * p[1] + (*this)(1,2) * p[2], 00488 (*this)(2,0) * p[0] + (*this)(2,1) * p[1] + (*this)(2,2) * p[2]); 00489 }
|
|
Definition at line 478 of file vecmath.h. References v. 00478 { 00479 return Vector3((*this)(0,0) * v[0] + (*this)(0,1) * v[1] + (*this)(0,2) * v[2], 00480 (*this)(1,0) * v[0] + (*this)(1,1) * v[1] + (*this)(1,2) * v[2], 00481 (*this)(2,0) * v[0] + (*this)(2,1) * v[1] + (*this)(2,2) * v[2]); 00482 }
|
|
Definition at line 471 of file vecmath.h. 00471 { 00472 for ( int i = 0; i < 9; i++ ) 00473 mat[i] *= s; 00474 return *this; 00475 }
|
|
Definition at line 446 of file vecmath.h.
|
|
Definition at line 445 of file vecmath.h.
|
|
Definition at line 464 of file vecmath.h. References mat. 00464 { 00465 Matrix3 matRet; 00466 for ( int i = 0; i < 9; i++ ) 00467 matRet.mat[i] = mat[i] + m.mat[i]; 00468 return matRet; 00469 }
|
|
Definition at line 437 of file vecmath.h. References mat. 00437 { 00438 memcpy( &mat[0], &m.mat[0], sizeof(double) * 16 ); 00439 return *this; 00440 }
|
|
Definition at line 546 of file vecmath.h. References mat. 00546 { 00547 for ( int i = 0; i < 9; i++ ) 00548 if ( mat[i] != m.mat[i] ) 00549 return false; 00550 return true; 00551 }
|
|
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 }
|
|
Definition at line 509 of file vecmath.h. References v. 00509 { 00510 return Matrix3(Vector3(u[0], v[0], w[0]), 00511 Vector3(u[1], v[1], w[1]), 00512 Vector3(u[2], v[2], w[2])); 00513 }
|
|
Definition at line 448 of file vecmath.h. Referenced by EMAN::operator<<().
|
|
Definition at line 456 of file vecmath.h. 00456 { 00457 Matrix3 matRet; 00458 for ( int i = 0; i < 3; i++ ) 00459 for ( int j = 0; j < 3; j++ ) 00460 matRet(i,j) = (*this)(j,i); 00461 return matRet; 00462 }
|
|
Definition at line 567 of file vecmath.h. Referenced by approxEqual(), operator+(), operator=(), and operator==(). |