TrinityCore
|
#include <Matrix3.h>
Public Member Functions | |
Matrix3 (const Any &any) | |
Any | toAny () const |
Matrix3 () | |
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) | |
bool | fuzzyEq (const Matrix3 &b) const |
Matrix3 (const class Quat &q) | |
void | serialize (class BinaryOutput &b) const |
void | deserialize (class BinaryInput &b) |
bool | isRightHanded () const |
void | set (float fEntry00, float fEntry01, float fEntry02, float fEntry10, float fEntry11, float fEntry12, float fEntry20, float fEntry21, float fEntry22) |
float * | operator[] (int iRow) |
const float * | operator[] (int iRow) const |
operator float * () | |
operator const float * () const | |
Vector3 | column (int c) const |
const Vector3 & | row (int r) const |
void | setColumn (int iCol, const Vector3 &vector) |
void | setRow (int iRow, const Vector3 &vector) |
Matrix3 & | operator= (const Matrix3 &rkMatrix) |
bool | operator== (const Matrix3 &rkMatrix) const |
bool | operator!= (const Matrix3 &rkMatrix) const |
Matrix3 | operator+ (const Matrix3 &rkMatrix) const |
Matrix3 | operator- (const Matrix3 &rkMatrix) const |
Matrix3 | operator* (const Matrix3 &rkMatrix) const |
Matrix3 | operator- () const |
Matrix3 & | operator+= (const Matrix3 &rkMatrix) |
Matrix3 & | operator-= (const Matrix3 &rkMatrix) |
Matrix3 & | operator*= (const Matrix3 &rkMatrix) |
Vector3 | operator* (const Vector3 &v) const |
Matrix3 | operator* (float fScalar) const |
Matrix3 & | operator*= (float k) |
Matrix3 & | operator/= (float k) |
bool | isOrthonormal () const |
Matrix3 | transpose () const |
bool | inverse (Matrix3 &rkInverse, float fTolerance=1e-06f) const |
Matrix3 | inverse (float fTolerance=1e-06f) const |
float | determinant () const |
void | singularValueDecomposition (Matrix3 &rkL, Vector3 &rkS, Matrix3 &rkR) const |
void | singularValueComposition (const Matrix3 &rkL, const Vector3 &rkS, const Matrix3 &rkR) |
void | orthonormalize () |
void | qDUDecomposition (Matrix3 &rkQ, Vector3 &rkD, Vector3 &rkU) const |
void | polarDecomposition (Matrix3 &R, Matrix3 &S) const |
float | spectralNorm () const |
float | squaredFrobeniusNorm () const |
float | frobeniusNorm () const |
float | l1Norm () const |
float | lInfNorm () const |
float | diffOneNorm (const Matrix3 &y) const |
void | toAxisAngle (Vector3 &rkAxis, float &rfRadians) const |
bool | toEulerAnglesXYZ (float &rfYAngle, float &rfPAngle, float &rfRAngle) const |
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 |
void | eigenSolveSymmetric (float afEigenvalue[3], Vector3 akEigenvector[3]) const |
std::string | toString () const |
Static Public Member Functions | |
static Matrix3 | fromColumns (const Vector3 &c0, const Vector3 &c1, const Vector3 &c2) |
static Matrix3 | fromRows (const Vector3 &r0, const Vector3 &r1, const Vector3 &r2) |
static Matrix3 | diagonal (float e00, float e11, float e22) |
static void | mul (const Matrix3 &A, const Matrix3 &B, Matrix3 &out) |
static void | transpose (const Matrix3 &A, Matrix3 &out) |
static Matrix3 | fromDiagonal (const Vector3 &d) |
static Matrix3 | fromAxisAngle (const Vector3 &rkAxis, float fRadians) |
static Matrix3 | fromUnitAxisAngle (const Vector3 &rkAxis, float fRadians) |
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 void | tensorProduct (const Vector3 &rkU, const Vector3 &rkV, Matrix3 &rkProduct) |
static const Matrix3 & | zero () |
static const Matrix3 & | identity () |
Static Public Attributes | |
static const float | EPSILON = 1e-06f |
Protected Member Functions | |
void | tridiagonal (float afDiag[3], float afSubDiag[3]) |
bool | qLAlgorithm (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 = 1e-04f |
static const int | ms_iSvdMaxIterations = 32 |
Private Member Functions | |
bool | operator< (const Matrix3 &) const |
bool | operator> (const Matrix3 &) const |
bool | operator<= (const Matrix3 &) const |
bool | operator>= (const Matrix3 &) const |
Static Private Member Functions | |
static void | _mul (const Matrix3 &A, const Matrix3 &B, Matrix3 &out) |
static void | _transpose (const Matrix3 &A, Matrix3 &out) |
Private Attributes | |
float | elt [3][3] |
Friends | |
Vector3 | operator* (const Vector3 &rkVector, const Matrix3 &rkMatrix) |
Matrix3 | operator* (double fScalar, const Matrix3 &rkMatrix) |
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.
Must be in one of the following forms:
|
inline |
Initial values are undefined for performance.
G3D::Matrix3::Matrix3 | ( | class BinaryInput & | b | ) |
G3D::Matrix3::Matrix3 | ( | const float | aafEntry[3][3] | ) |
G3D::Matrix3::Matrix3 | ( | float | fEntry00, |
float | fEntry01, | ||
float | fEntry02, | ||
float | fEntry10, | ||
float | fEntry11, | ||
float | fEntry12, | ||
float | fEntry20, | ||
float | fEntry21, | ||
float | fEntry22 | ||
) |
Constructs a matrix from a quaternion. [Graphics] Gems II, p. 351–354 [Implementation] from Watt and Watt, pg 362
Multiplication where out != A and out != B
Vector3 G3D::Matrix3::column | ( | int | c | ) | const |
void G3D::Matrix3::deserialize | ( | class BinaryInput & | b | ) |
float G3D::Matrix3::determinant | ( | ) | const |
|
inlinestatic |
void G3D::Matrix3::eigenSolveSymmetric | ( | float | afEigenvalue[3], |
Vector3 | akEigenvector[3] | ||
) | const |
eigensolver, matrix must be symmetric
float G3D::Matrix3::frobeniusNorm | ( | ) | const |
|
inlinestatic |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
Assumes that rkAxis has unit length
Matrix3 G3D::Matrix3::inverse | ( | float | fTolerance = 1e-06f | ) | const |
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 |
Matrix-matrix multiply
matrix * vector [3x3 * 3x1 = 3x1]
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 | ) |
|
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 |
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::singularValueComposition | ( | const Matrix3 & | rkL, |
const Vector3 & | rkS, | ||
const Matrix3 & | rkR | ||
) |
singular value decomposition
singular value decomposition
float G3D::Matrix3::spectralNorm | ( | ) | const |
float G3D::Matrix3::squaredFrobeniusNorm | ( | ) | const |
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 |
std::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
.
Matrix3 G3D::Matrix3::transpose | ( | ) | const |
|
protected |
scalar * matrix
|
private |
|
static |
|
staticprotected |
|
staticprotected |