#include <dvm3/dvm3_rotmat.h>
Public Types | |
enum | EEulerAngleType { EOSAC_az_el_clock = 0, EX_convention = 1, EY_convention = 2 } |
enum | EInputVecPair { E_XY, E_YZ, E_ZX, E_XZ, E_ZY, E_YX } |
Public Member Functions | |
~dvm3_RotMat () | |
dvm3_RotMat () | |
dvm3_RotMat (dvm3_RotMat const &m) | |
dvm3_RotMat (dvm3_Vector const &x, dvm3_Vector const &y, dvm3_Vector const &z, double const tol=100.0 *DBL_EPSILON) | |
dvm3_RotMat (double const x[], double const y[], double const z[], double const tol=100.0 *DBL_EPSILON) | |
dvm3_RotMat (double angle0, double angle1, double angle2, EEulerAngleType angle_type=EOSAC_az_el_clock) | |
dvm3_RotMat (dvm3_Vector const &v0, dvm3_Vector const &v1, EInputVecPair type) | |
dvm3_RotMat (double const v0[], double const v1[], EInputVecPair type) | |
void | init (double angle0, double angle1, double angle2, EEulerAngleType angle_type=EOSAC_az_el_clock) |
void | init (dvm3_Vector const &v0, dvm3_Vector const &v1, EInputVecPair type) |
void | init (double const v0[], double const v1[], EInputVecPair type) |
dvm3_RotMat & | operator= (dvm3_RotMat const &rhs) |
void | invert () |
int | is_rotation_matrix (double const tol=100.0 *DBL_EPSILON) const |
This is intended as a small component which can be inexpensively created on the stack; the constructors and destructor do not make use of dynamic allocation. The dvm3_RotMat default constructor initializes the matrix to a unit matrix (i.e., no rotation).
Suppose we are considering two frames, an initial standard frame, S, and a body frame, B. Let eS,i, i = 0, 1, 2, denote the i'th basis vector for frame S, and eB,i, i = 0, 1, 2, the corresponding basis vectors in frame B. The rotation matrix from S to B can be written as
Definition at line 69 of file dvm3_rotmat.h.
dvm3_RotMat::~dvm3_RotMat | ( | ) | [inline] |
Do-nothing destructor
Definition at line 527 of file dvm3_rotmat.h.
dvm3_RotMat::dvm3_RotMat | ( | ) |
Default constructor; a unit matrix is generated by default.
Definition at line 44 of file dvm3_rotmat.cc.
dvm3_RotMat::dvm3_RotMat | ( | dvm3_RotMat const & | m | ) | [inline] |
Copy constructor.
m | rotation matrix to copy |
Definition at line 532 of file dvm3_rotmat.h.
dvm3_RotMat::dvm3_RotMat | ( | dvm3_Vector const & | x, | |
dvm3_Vector const & | y, | |||
dvm3_Vector const & | z, | |||
double const | tol = 100.0 * DBL_EPSILON | |||
) |
Constructor.
Each row is a coordinate unit vector. The vectors are assumed to be orthonormal; an error is issued and exit(1) is called if the vectors are not orthonormal to within tolerance tol. If the vectors are indeed orthonormal within tolerance tol, they are further explicitly orthonormalized by a series of cross products and scalings; consequently the matrix rows may differ slightly from the input x, y, z dvm3_Vector's.
x | x row | |
y | y row | |
z | z row | |
tol | tolerance for orthonormality |
Definition at line 53 of file dvm3_rotmat.cc.
References is_rotation_matrix(), and dvm3_Matrix::orthonormalize().
dvm3_RotMat::dvm3_RotMat | ( | double const | x[], | |
double const | y[], | |||
double const | z[], | |||
double const | tol = 100.0 * DBL_EPSILON | |||
) |
Constructor.
Each row is a coordinate unit vector. The vectors are assumed to be orthonormal; an error is issued and exit(1) is called if the vectors are not orthonormal to within tolerance tol. If the vectors are indeed orthonormal within tolerance tol, they are further explicitly orthonormalized by a series of cross products and scalings; consequently the matrix rows may differ slightly from the input x, y, z dvm3_Vector's.
x | x row | |
y | y row | |
z | z row | |
tol | tolerance for orthonormality |
Definition at line 76 of file dvm3_rotmat.cc.
References is_rotation_matrix(), and dvm3_Matrix::orthonormalize().
dvm3_RotMat::dvm3_RotMat | ( | double | angle0, | |
double | angle1, | |||
double | angle2, | |||
dvm3_RotMat::EEulerAngleType | angle_type = EOSAC_az_el_clock | |||
) |
Constructor.
Construct a rotation matrix based on 3 Euler angles (in radians). This rotation matrix describes the rotation from an external system coordinate to a coordinate system attached to a rigid body.
A body initially has its coordinate system aligned with the standard external coordinates. The body is rotated to its final orientation by performing a series of rotations, each rotation about a current body axis. That is
angle_type.
Because we want a transformation from the space coordinates to the body coordinates, the rotation matrix components actually correspond to the inverse of the transformation which generated the rigid body position, i.e.,
Because of rotation matrices are orthogonal, the inverse motion (from the body-centered coordinate system back to the standard coordinate system) is simply the transpose of the rotation matrix constructed by this constructor.
angle0 1st Euler angle angle1 2nd Euler angle angle2 3rd Euler angle angle_type type of Euler angles to use
Definition at line 111 of file dvm3_rotmat.cc.
References init().
dvm3_RotMat::dvm3_RotMat | ( | dvm3_Vector const & | v0, | |
dvm3_Vector const & | v1, | |||
EInputVecPair | type | |||
) |
Constructor.
Construct a rotation matrix based on two (non-colinear) vectors. The rotation matrix is constructed by sequential application cross products.
If type == E_XY, the vectors passed in are assumed to lie in the x-y plane with v0 an x-like vector and v1 a y-like vector; e_x is v0. e_z is constructed from e_x cross v1. e_y is constructed from e_z cross e_x. The three vectors e_x, e_y, and e_z are normalized.
If type == E_YZ, the vectors passed in are assumed to lie in the y-z plane with v0 an y-like vector and v1 a z-like vector; e_y is v0. e_x is constructed from e_y cross v1. e_z is constructed from e_x cross e_y. The three vectors e_x, e_y, and e_z are normalized.
If type == E_ZX, the vectors passed in are assumed to lie in the x-z plane with v0 an z-like vector and v1 a x-like vector; e_z is v0. e_y is constructed from e_z cross v1. e_x is constructed from e_y cross e_z. The three vectors e_x, e_y, and e_z are normalized.
If type == E_YX, the vectors passed in are assumed to lie in the x-y plane with v0 a y-like vector and v1 an x-like vector; e_y is v0. e_z is constructed from v1 cross e_y. e_x is constructed from e_y cross e_z. The three vectors e_x, e_y, and e_z are normalized.
If type == E_ZY, the vectors passed in are assumed to lie in the y-z plane with v0 a z-like vector and v1 a y-like vector; e_z is v0. e_x is constructed from v1 cross e_z. e_y is constructed from e_z cross e_x. The three vectors e_x, e_y, and e_z are normalized.
If type == E_XZ, the vectors passed in are assumed to lie in the x-z plane with v0 an x-like vector and v1 a z-like vector; e_x is v0. e_y is constructed from v1 cross e_x. e_z is constructed from e_x cross e_y. The three vectors e_x, e_y, and e_z are normalized.
v0 | 1st vector | |
v1 | 2nd vector | |
type | type of input vectors |
Definition at line 160 of file dvm3_rotmat.cc.
References init().
dvm3_RotMat::dvm3_RotMat | ( | double const | v0[], | |
double const | v1[], | |||
EInputVecPair | type | |||
) |
Constructor.
Construct a rotation matrix based on two (non-colinear) vectors. The rotation matrix is constructed by sequential application cross products.
If type == E_XY, the vectors passed in are assumed to lie in the x-y plane with v0 an x-like vector and v1 a y-like vector; e_x is v0. e_z is constructed from e_x cross v1. e_y is constructed from e_z cross e_x. The three vectors e_x, e_y, and e_z are normalized.
If type == E_YZ, the vectors passed in are assumed to lie in the y-z plane with v0 an y-like vector and v1 a z-like vector; e_y is v0. e_x is constructed from e_y cross v1. e_z is constructed from e_x cross e_y. The three vectors e_x, e_y, and e_z are normalized.
If type == E_ZX, the vectors passed in are assumed to lie in the x-z plane with v0 an z-like vector and v1 a x-like vector; e_z is v0. e_y is constructed from e_z cross v1. e_x is constructed from e_y cross e_z. The three vectors e_x, e_y, and e_z are normalized.
If type == E_YX, the vectors passed in are assumed to lie in the x-y plane with v0 a y-like vector and v1 an x-like vector; e_y is v0. e_z is constructed from v1 cross e_y. e_x is constructed from e_y cross e_z. The three vectors e_x, e_y, and e_z are normalized.
If type == E_ZY, the vectors passed in are assumed to lie in the y-z plane with v0 a z-like vector and v1 a y-like vector; e_z is v0. e_x is constructed from v1 cross e_z. e_y is constructed from e_z cross e_x. The three vectors e_x, e_y, and e_z are normalized.
If type == E_XZ, the vectors passed in are assumed to lie in the x-z plane with v0 an x-like vector and v1 a z-like vector; e_x is v0. e_y is constructed from v1 cross e_x. e_z is constructed from e_x cross e_y. The three vectors e_x, e_y, and e_z are normalized.
v0 | 1st vector | |
v1 | 2nd vector | |
type | type of input vectors |
Definition at line 211 of file dvm3_rotmat.cc.
References init().
void dvm3_RotMat::init | ( | double | angle0, | |
double | angle1, | |||
double | angle2, | |||
dvm3_RotMat::EEulerAngleType | angle_type = EOSAC_az_el_clock | |||
) |
Initialize a rotation matrix based on 3 Euler angles (in radians). This rotation matrix describes the rotation from an external system coordinate to a coordinate system attached to a rigid body.
A body initially has its coordinate system aligned with the standard external coordinates. The body is rotated to its final orientation by performing a series of rotations, each rotation about a current body axis. That is
angle_type.
Because we want a transformation from the space coordinates to the body coordinates, the rotation matrix components actually correspond to the inverse of the transformation which generated the rigid body position, i.e.,
Because of rotation matrices are orthogonal, the inverse motion (from the body-centered coordinate system back to the standard coordinate system) is simply the transpose of the rotation matrix constructed by this constructor.
angle0 1st Euler angle angle1 2nd Euler angle angle2 3rd Euler angle angle_type type of Euler angles to use
Definition at line 237 of file dvm3_rotmat.cc.
Referenced by dvm3_RotMat().
void dvm3_RotMat::init | ( | dvm3_Vector const & | v0, | |
dvm3_Vector const & | v1, | |||
EInputVecPair | type | |||
) |
Initialize a rotation matrix based on two (non-colinear) vectors. The rotation matrix is constructed by sequential application cross products.
If type == E_XY, the vectors passed in are assumed to lie in the x-y plane with v0 an x-like vector and v1 a y-like vector; e_x is v0. e_z is constructed from e_x cross v1. e_y is constructed from e_z cross e_x. The three vectors e_x, e_y, and e_z are normalized.
If type == E_YZ, the vectors passed in are assumed to lie in the y-z plane with v0 an y-like vector and v1 a z-like vector; e_y is v0. e_x is constructed from e_y cross v1. e_z is constructed from e_x cross e_y. The three vectors e_x, e_y, and e_z are normalized.
If type == E_ZX, the vectors passed in are assumed to lie in the x-z plane with v0 an z-like vector and v1 a x-like vector; e_z is v0. e_y is constructed from e_z cross v1. e_x is constructed from e_y cross e_z. The three vectors e_x, e_y, and e_z are normalized.
If type == E_YX, the vectors passed in are assumed to lie in the x-y plane with v0 a y-like vector and v1 an x-like vector; e_y is v0. e_z is constructed from v1 cross e_y. e_x is constructed from e_y cross e_z. The three vectors e_x, e_y, and e_z are normalized.
If type == E_ZY, the vectors passed in are assumed to lie in the y-z plane with v0 a z-like vector and v1 a y-like vector; e_z is v0. e_x is constructed from v1 cross e_z. e_y is constructed from e_z cross e_x. The three vectors e_x, e_y, and e_z are normalized.
If type == E_XZ, the vectors passed in are assumed to lie in the x-z plane with v0 an x-like vector and v1 a z-like vector; e_x is v0. e_y is constructed from v1 cross e_x. e_z is constructed from e_x cross e_y. The three vectors e_x, e_y, and e_z are normalized.
v0 | 1st vector | |
v1 | 2nd vector | |
type | type of input vectors |
Definition at line 384 of file dvm3_rotmat.cc.
References dvm3_Vector::data_.
void dvm3_RotMat::init | ( | double const | v0[], | |
double const | v1[], | |||
EInputVecPair | type | |||
) |
Initialize a rotation matrix based on two (non-colinear) vectors. The rotation matrix is constructed by sequential application cross products.
If type == E_XY, the vectors passed in are assumed to lie in the x-y plane with v0 an x-like vector and v1 a y-like vector; e_x is v0. e_z is constructed from e_x cross v1. e_y is constructed from e_z cross e_x. The three vectors e_x, e_y, and e_z are normalized.
If type == E_YZ, the vectors passed in are assumed to lie in the y-z plane with v0 an y-like vector and v1 a z-like vector; e_y is v0. e_x is constructed from e_y cross v1. e_z is constructed from e_x cross e_y. The three vectors e_x, e_y, and e_z are normalized.
If type == E_ZX, the vectors passed in are assumed to lie in the x-z plane with v0 an z-like vector and v1 a x-like vector; e_z is v0. e_y is constructed from e_z cross v1. e_x is constructed from e_y cross e_z. The three vectors e_x, e_y, and e_z are normalized.
If type == E_YX, the vectors passed in are assumed to lie in the x-y plane with v0 a y-like vector and v1 an x-like vector; e_y is v0. e_z is constructed from v1 cross e_y. e_x is constructed from e_y cross e_z. The three vectors e_x, e_y, and e_z are normalized.
If type == E_ZY, the vectors passed in are assumed to lie in the y-z plane with v0 a z-like vector and v1 a y-like vector; e_z is v0. e_x is constructed from v1 cross e_z. e_y is constructed from e_z cross e_x. The three vectors e_x, e_y, and e_z are normalized.
If type == E_XZ, the vectors passed in are assumed to lie in the x-z plane with v0 an x-like vector and v1 a z-like vector; e_x is v0. e_y is constructed from v1 cross e_x. e_z is constructed from e_x cross e_y. The three vectors e_x, e_y, and e_z are normalized.
v0 | 1st vector | |
v1 | 2nd vector | |
type | type of input vectors |
Definition at line 502 of file dvm3_rotmat.cc.
dvm3_RotMat & dvm3_RotMat::operator= | ( | dvm3_RotMat const & | rhs | ) | [inline] |
Copy-assignment operator
rhs | value to be assigned. |
Definition at line 538 of file dvm3_rotmat.h.
References dvm3_Matrix::data_.
void dvm3_RotMat::invert | ( | ) |
Invert (i.e., transpose) this rotation matrix.
Definition at line 581 of file dvm3_rotmat.cc.
int dvm3_RotMat::is_rotation_matrix | ( | double const | tol = 100.0 * DBL_EPSILON |
) | const |
Test this rotation matrix for orthonormality.
tol | tolerance for determining orthonormality |
Definition at line 598 of file dvm3_rotmat.cc.
Referenced by dvm3_RotMat().