Support Forum G3D Web Page |
A 3x3 matrix. More...
Public Member Functions | |
Matrix3 (const Any &any) | |
Must be in one of the following forms: More... | |
Matrix3 (DoNotInitialize dni) | |
Matrix3 () | |
Initial values are undefined for performance. More... | |
Matrix3 (class BinaryInput &b) | |
Matrix3 (const float aafEntry[3][3]) | |
Matrix3 (const Matrix3 &rkMatrix) | |
Matrix3 (float fEntry00, float fEntry01, float fEntry02, float fEntry10, float fEntry11, float fEntry12, float fEntry20, float fEntry21, float fEntry22) | |
Matrix3 (const class Quat &q) | |
Constructs a matrix from a quaternion. More... | |
Vector3 | column (int c) const |
void | deserialize (class BinaryInput &b) |
float | determinant () const |
float | diffOneNorm (const Matrix3 &y) const |
void | eigenSolveSymmetric (float afEigenvalue[3], Vector3 akEigenvector[3]) const |
eigensolver, matrix must be symmetric More... | |
float | frobeniusNorm () const |
bool | fuzzyEq (const Matrix3 &b) const |
bool | inverse (Matrix3 &rkInverse, float fTolerance=1e-06) const |
Matrix3 | inverse (float fTolerance=1e-06) const |
bool | is3DRotationDilation () const |
Returns true if the rows are orthogonal, have the same length, and the determinant is greater than zero. More... | |
bool | isOrthonormal () const |
Returns true if the rows and column L2 norms are 1.0 and the rows are orthogonal. More... | |
bool | isRightHanded () const |
Returns true if column(0).cross(column(1)).dot(column(2)) > 0. More... | |
float | l1Norm () const |
float | lInfNorm () const |
operator const float * () const | |
operator float * () | |
bool | operator!= (const Matrix3 &rkMatrix) const |
Matrix3 | operator* (const Matrix3 &rkMatrix) const |
Matrix-matrix multiply. More... | |
Vector3 | operator* (const Vector3 &v) const |
matrix * vector [3x3 * 3x1 = 3x1] More... | |
Matrix3 | operator* (float fScalar) const |
matrix * scalar More... | |
Matrix3 & | operator*= (const Matrix3 &rkMatrix) |
Matrix-matrix multiply. More... | |
Matrix3 & | operator*= (float k) |
Matrix3 | operator+ (const Matrix3 &rkMatrix) const |
Matrix3 & | operator+= (const Matrix3 &rkMatrix) |
Matrix3 | operator- (const Matrix3 &rkMatrix) const |
Matrix3 | operator- () const |
Matrix3 & | operator-= (const Matrix3 &rkMatrix) |
Matrix3 & | operator/= (float k) |
Matrix3 & | operator= (const Matrix3 &rkMatrix) |
bool | operator== (const Matrix3 &rkMatrix) const |
float * | operator[] (int iRow) |
Member access, allows use of construct mat[r][c] More... | |
const float * | operator[] (int iRow) const |
void | orthonormalize () |
Gram-Schmidt orthonormalization (applied to columns of rotation matrix) More... | |
void | polarDecomposition (Matrix3 &R, Matrix3 &S) const |
Polar decomposition of a matrix. More... | |
void | qDUDecomposition (Matrix3 &rkQ, Vector3 &rkD, Vector3 &rkU) const |
orthogonal Q, diagonal D, upper triangular U stored as (u01,u02,u12) More... | |
const Vector3 & | row (int r) const |
void | serialize (class BinaryOutput &b) const |
void | set (float fEntry00, float fEntry01, float fEntry02, float fEntry10, float fEntry11, float fEntry12, float fEntry20, float fEntry21, float fEntry22) |
Sets all elements. More... | |
void | setColumn (int iCol, const Vector3 &vector) |
void | setRow (int iRow, const Vector3 &vector) |
void | singularValueComposition (const Matrix3 &rkL, const Vector3 &rkS, const Matrix3 &rkR) |
singular value decomposition More... | |
void | singularValueDecomposition (Matrix3 &rkL, Vector3 &rkS, Matrix3 &rkR) const |
singular value decomposition More... | |
float | spectralNorm () const |
Matrix norms. More... | |
float | squaredFrobeniusNorm () const |
Any | toAny () const |
void | toAxisAngle (Vector3 &rkAxis, float &rfRadians) const |
matrix must be orthonormal More... | |
bool | toEulerAnglesXYZ (float &rfYAngle, float &rfPAngle, float &rfRAngle) const |
The matrix must be orthonormal. More... | |
bool | toEulerAnglesXZY (float &rfYAngle, float &rfPAngle, float &rfRAngle) const |
bool | toEulerAnglesYXZ (float &rfYAngle, float &rfPAngle, float &rfRAngle) const |
bool | toEulerAnglesYZX (float &rfYAngle, float &rfPAngle, float &rfRAngle) const |
bool | toEulerAnglesZXY (float &rfYAngle, float &rfPAngle, float &rfRAngle) const |
bool | toEulerAnglesZYX (float &rfYAngle, float &rfPAngle, float &rfRAngle) const |
String | toString () const |
Matrix3 | transpose () const |
Static Public Member Functions | |
static Matrix3 | diagonal (float e00, float e11, float e22) |
static Matrix3 | fromAxisAngle (const Vector3 &rkAxis, float fRadians) |
static Matrix3 | fromColumns (const Vector3 &c0, const Vector3 &c1, const Vector3 &c2) |
static Matrix3 | fromDiagonal (const Vector3 &d) |
static Matrix3 | fromEulerAnglesXYZ (float fYAngle, float fPAngle, float fRAngle) |
static Matrix3 | fromEulerAnglesXZY (float fYAngle, float fPAngle, float fRAngle) |
static Matrix3 | fromEulerAnglesYXZ (float fYAngle, float fPAngle, float fRAngle) |
static Matrix3 | fromEulerAnglesYZX (float fYAngle, float fPAngle, float fRAngle) |
static Matrix3 | fromEulerAnglesZXY (float fYAngle, float fPAngle, float fRAngle) |
static Matrix3 | fromEulerAnglesZYX (float fYAngle, float fPAngle, float fRAngle) |
static Matrix3 | fromRows (const Vector3 &r0, const Vector3 &r1, const Vector3 &r2) |
static Matrix3 | fromUnitAxisAngle (const Vector3 &rkAxis, float fRadians) |
Assumes that rkAxis has unit length. More... | |
static const Matrix3 & | identity () |
static void | mul (const Matrix3 &A, const Matrix3 &B, Matrix3 &out) |
Optimized implementation of out = A * B. More... | |
static void | tensorProduct (const Vector3 &rkU, const Vector3 &rkV, Matrix3 &rkProduct) |
static void | transpose (const Matrix3 &A, Matrix3 &out) |
Optimized implementation of out = A.transpose(). More... | |
static const Matrix3 & | zero () |
Static Public Attributes | |
static const float | EPSILON |
Protected Member Functions | |
bool | qLAlgorithm (float afDiag[3], float afSubDiag[3]) |
void | tridiagonal (float afDiag[3], float afSubDiag[3]) |
Static Protected Member Functions | |
static void | bidiagonalize (Matrix3 &kA, Matrix3 &kL, Matrix3 &kR) |
static void | golubKahanStep (Matrix3 &kA, Matrix3 &kL, Matrix3 &kR) |
static float | maxCubicRoot (float afCoeff[3]) |
Static Protected Attributes | |
static const float | ms_fSvdEpsilon |
static const int | ms_iSvdMaxIterations |
Friends | |
Vector3 | operator* (const Vector3 &rkVector, const Matrix3 &rkMatrix) |
vector * matrix [1x3 * 3x3 = 1x3] More... | |
Matrix3 | operator* (double fScalar, const Matrix3 &rkMatrix) |
scalar * matrix More... | |
Matrix3 | operator* (float fScalar, const Matrix3 &rkMatrix) |
Matrix3 | operator* (int fScalar, const Matrix3 &rkMatrix) |
A 3x3 matrix.
Do not subclass. Data is unitializd when default constructed.
G3D::Matrix3::Matrix3 | ( | const Any & | any | ) |
Must be in one of the following forms:
|
inline |
|
inline |
Initial values are undefined for performance.
Referenced by diagonal(), and fromDiagonal().
G3D::Matrix3::Matrix3 | ( | class BinaryInput & | b | ) |
G3D::Matrix3::Matrix3 | ( | const float | aafEntry[3][3] | ) |
G3D::Matrix3::Matrix3 | ( | const Matrix3 & | rkMatrix | ) |
G3D::Matrix3::Matrix3 | ( | float | fEntry00, |
float | fEntry01, | ||
float | fEntry02, | ||
float | fEntry10, | ||
float | fEntry11, | ||
float | fEntry12, | ||
float | fEntry20, | ||
float | fEntry21, | ||
float | fEntry22 | ||
) |
G3D::Matrix3::Matrix3 | ( | const class Quat & | q | ) |
Constructs a matrix from a quaternion.
|
staticprotected |
Vector3 G3D::Matrix3::column | ( | int | c | ) | const |
void G3D::Matrix3::deserialize | ( | class BinaryInput & | b | ) |
float G3D::Matrix3::determinant | ( | ) | const |
Referenced by G3D::determinant(), and G3D::CoordinateFrame::pointToObjectSpace().
|
inlinestatic |
float G3D::Matrix3::diffOneNorm | ( | const Matrix3 & | y | ) | const |
void G3D::Matrix3::eigenSolveSymmetric | ( | float | afEigenvalue[3], |
Vector3 | akEigenvector[3] | ||
) | const |
eigensolver, matrix must be symmetric
float G3D::Matrix3::frobeniusNorm | ( | ) | const |
Referenced by G3D::Matrix4::pitchDegrees(), G3D::Matrix4::rollDegrees(), and G3D::Matrix4::yawDegrees().
|
inlinestatic |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
Assumes that rkAxis has unit length.
bool G3D::Matrix3::fuzzyEq | ( | const Matrix3 & | b | ) | const |
|
staticprotected |
|
static |
Referenced by G3D::Matrix4::translation().
bool G3D::Matrix3::inverse | ( | Matrix3 & | rkInverse, |
float | fTolerance = 1e-06 |
||
) | const |
Matrix3 G3D::Matrix3::inverse | ( | float | fTolerance = 1e-06 | ) | const |
bool G3D::Matrix3::is3DRotationDilation | ( | ) | const |
Returns true if the rows are orthogonal, have the same length, and the determinant is greater than zero.
bool G3D::Matrix3::isOrthonormal | ( | ) | const |
Returns true if the rows and column L2 norms are 1.0 and the rows are orthogonal.
bool G3D::Matrix3::isRightHanded | ( | ) | const |
Returns true if column(0).cross(column(1)).dot(column(2)) > 0.
float G3D::Matrix3::l1Norm | ( | ) | const |
float G3D::Matrix3::lInfNorm | ( | ) | const |
|
staticprotected |
Optimized implementation of out = A * B.
It is safe (but slow) to call with A, B, and out possibly pointer equal to one another.
|
inline |
|
inline |
bool G3D::Matrix3::operator!= | ( | const Matrix3 & | rkMatrix | ) | const |
Matrix3 G3D::Matrix3::operator* | ( | float | fScalar | ) | const |
matrix * scalar
Matrix3& G3D::Matrix3::operator*= | ( | float | k | ) |
Matrix3 G3D::Matrix3::operator- | ( | ) | const |
Matrix3& G3D::Matrix3::operator/= | ( | float | k | ) |
bool G3D::Matrix3::operator== | ( | const Matrix3 & | rkMatrix | ) | const |
|
inline |
Member access, allows use of construct mat[r][c]
|
inline |
void G3D::Matrix3::orthonormalize | ( | ) |
Gram-Schmidt orthonormalization (applied to columns of rotation matrix)
Polar decomposition of a matrix.
Based on pseudocode from Nicholas J Higham, "Computing the Polar Decomposition – with Applications Siam Journal of Science and Statistical Computing, Vol 7, No. 4, October 1986.
Decomposes A into R*S, where R is orthogonal and S is symmetric.
Ken Shoemake's "Matrix animation and polar decomposition" in Proceedings of the conference on Graphics interface '92 seems to be better known in the world of graphics, but Higham's version uses a scaling constant that can lead to faster convergence than Shoemake's when the initial matrix is far from orthogonal.
orthogonal Q, diagonal D, upper triangular U stored as (u01,u02,u12)
|
protected |
const Vector3& G3D::Matrix3::row | ( | int | r | ) | const |
void G3D::Matrix3::serialize | ( | class BinaryOutput & | b | ) | const |
void G3D::Matrix3::set | ( | float | fEntry00, |
float | fEntry01, | ||
float | fEntry02, | ||
float | fEntry10, | ||
float | fEntry11, | ||
float | fEntry12, | ||
float | fEntry20, | ||
float | fEntry21, | ||
float | fEntry22 | ||
) |
Sets all elements.
void G3D::Matrix3::setColumn | ( | int | iCol, |
const Vector3 & | vector | ||
) |
void G3D::Matrix3::setRow | ( | int | iRow, |
const Vector3 & | vector | ||
) |
void G3D::Matrix3::singularValueComposition | ( | const Matrix3 & | rkL, |
const Vector3 & | rkS, | ||
const Matrix3 & | rkR | ||
) |
singular value decomposition
singular value decomposition
float G3D::Matrix3::spectralNorm | ( | ) | const |
Matrix norms.
float G3D::Matrix3::squaredFrobeniusNorm | ( | ) | const |
|
static |
Any G3D::Matrix3::toAny | ( | ) | const |
void G3D::Matrix3::toAxisAngle | ( | Vector3 & | rkAxis, |
float & | rfRadians | ||
) | const |
matrix must be orthonormal
bool G3D::Matrix3::toEulerAnglesXYZ | ( | float & | rfYAngle, |
float & | rfPAngle, | ||
float & | rfRAngle | ||
) | const |
The matrix must be orthonormal.
The decomposition is yaw*pitch*roll where yaw is rotation about the Up vector, pitch is rotation about the right axis, and roll is rotation about the Direction axis.
bool G3D::Matrix3::toEulerAnglesXZY | ( | float & | rfYAngle, |
float & | rfPAngle, | ||
float & | rfRAngle | ||
) | const |
bool G3D::Matrix3::toEulerAnglesYXZ | ( | float & | rfYAngle, |
float & | rfPAngle, | ||
float & | rfRAngle | ||
) | const |
bool G3D::Matrix3::toEulerAnglesYZX | ( | float & | rfYAngle, |
float & | rfPAngle, | ||
float & | rfRAngle | ||
) | const |
bool G3D::Matrix3::toEulerAnglesZXY | ( | float & | rfYAngle, |
float & | rfPAngle, | ||
float & | rfRAngle | ||
) | const |
bool G3D::Matrix3::toEulerAnglesZYX | ( | float & | rfYAngle, |
float & | rfPAngle, | ||
float & | rfRAngle | ||
) | const |
String G3D::Matrix3::toString | ( | ) | const |
Optimized implementation of out = A.transpose().
It is safe (but slow) to call with A and out possibly pointer equal to one another.
Note that A.transpose() * v
can be computed more efficiently as v * A
.
Referenced by G3D::CoordinateFrame::inverse(), and transpose().
Matrix3 G3D::Matrix3::transpose | ( | ) | const |
|
protected |
|
static |
vector * matrix [1x3 * 3x3 = 1x3]
|
static |
|
staticprotected |
|
staticprotected |