PixelLightAPI
.
|
4x4 matrix More...
#include <Matrix4x4.h>
Public Member Functions | |
Matrix4x4 () | |
Default constructor setting an identity matrix. | |
Matrix4x4 (const float fS[]) | |
PLMATH_API | Matrix4x4 (const Matrix3x3 &mM) |
PLMATH_API | Matrix4x4 (const Matrix3x4 &mM) |
Matrix4x4 (const Matrix4x4 &mM) | |
Matrix4x4 (float fXX, float fXY, float fXZ, float fXW, float fYX, float fYY, float fYZ, float fYW, float fZX, float fZY, float fZZ, float fZW, float fWX, float fWY, float fWZ, float fWW) | |
~Matrix4x4 () | |
PLMATH_API bool | operator== (const Matrix3x4 &mM) const |
PLMATH_API bool | operator== (const Matrix4x4 &mM) const |
PLMATH_API bool | operator!= (const Matrix3x4 &mM) const |
PLMATH_API bool | operator!= (const Matrix4x4 &mM) const |
PLMATH_API bool | CompareScale (const Matrix4x4 &mM, float fEpsilon=Math::Epsilon) const |
PLMATH_API bool | CompareTranslation (const Matrix4x4 &mM, float fEpsilon=Math::Epsilon) const |
PLMATH_API bool | CompareRotation (const Matrix4x4 &mM, float fEpsilon=Math::Epsilon) const |
Matrix4x4 & | operator= (const float fS[]) |
PLMATH_API Matrix4x4 & | operator= (const Matrix3x3 &mM) |
PLMATH_API Matrix4x4 & | operator= (const Matrix3x4 &mM) |
Matrix4x4 & | operator= (const Matrix4x4 &mM) |
Matrix4x4 | operator+ (const Matrix4x4 &mM) const |
void | operator+= (const Matrix4x4 &mM) |
Matrix4x4 | operator- () const |
Matrix4x4 | operator- (const Matrix4x4 &mM) const |
void | operator-= (const Matrix4x4 &mM) |
Matrix4x4 | operator* (float fS) const |
void | operator*= (float fS) |
Vector2 | operator* (const Vector2 &vV) const |
Vector3 | operator* (const Vector3 &vV) const |
Vector4 | operator* (const Vector4 &vV) const |
PLMATH_API Matrix4x4 | operator* (const Matrix3x4 &mM) const |
PLMATH_API Matrix4x4 | operator* (const Matrix4x4 &mM) const |
void | operator*= (const Matrix3x4 &mM) |
void | operator*= (const Matrix4x4 &mM) |
Matrix4x4 | operator/ (float fS) const |
void | operator/= (float fS) |
float | operator[] (int nIndex) const |
float & | operator[] (int nIndex) |
float | operator() (PLCore::uint32 nRow=0, PLCore::uint32 nColumn=0) const |
float & | operator() (PLCore::uint32 nRow=0, PLCore::uint32 nColumn=0) |
operator float * () | |
operator const float * () const | |
bool | IsZero () const |
Returns whether or not this matrix is the zero matrix using an epsilon environment. | |
bool | IsTrueZero () const |
Returns whether or not this matrix is truly the zero matrix. | |
void | SetZero () |
Sets a zero matrix. | |
bool | IsIdentity () const |
Returns whether or not this matrix is the identity matrix using an epsilon environment. | |
bool | IsTrueIdentity () const |
Returns whether or not this matrix is truly the identity matrix. | |
void | SetIdentity () |
Sets an identity matrix. | |
PLMATH_API void | Set (float fXX, float fXY, float fXZ, float fXW, float fYX, float fYY, float fYZ, float fYW, float fZX, float fZY, float fZZ, float fZW, float fWX, float fWY, float fWZ, float fWW) |
Sets the elements of the matrix. | |
Vector4 | GetRow (PLCore::uint8 nRow) const |
Returns a requested row. | |
void | SetRow (PLCore::uint8 nRow, const Vector4 &vRow) |
Sets a row. | |
Vector4 | GetColumn (PLCore::uint8 nColumn) const |
Returns a requested column. | |
void | SetColumn (PLCore::uint8 nColumn, const Vector4 &vColumn) |
Sets a column. | |
bool | IsSymmetric () const |
Returns true if the matrix is symmetric. | |
bool | IsOrthogonal () const |
Returns true if this matrix is orthogonal. | |
bool | IsRotationMatrix () const |
Returns true if this matrix is a rotation matrix. | |
bool | IsRotationTranslationMatrix () const |
Returns true if this matrix is a rotation and translation matrix. | |
float | GetTrace () const |
Returns the trace of the matrix. | |
PLMATH_API float | GetDeterminant () const |
Returns the determinant of the matrix. | |
PLMATH_API void | Transpose () |
Transpose this matrix. | |
PLMATH_API Matrix4x4 | GetTransposed () const |
Returns the transposed matrix. | |
PLMATH_API bool | Invert () |
Inverts the matrix. | |
PLMATH_API Matrix4x4 | GetInverted () const |
Returns the inverse of the matrix. | |
PLMATH_API Vector3 | RotateVector (float fX, float fY, float fZ, bool bUniformScale=false) const |
Rotates a vector. | |
PLMATH_API Vector3 | RotateVector (const Vector3 &vV, bool bUniformScale=false) const |
Rotates a vector. | |
void | SetScaleMatrix (float fX, float fY, float fZ) |
Sets a scale matrix. | |
void | SetScaleMatrix (const Vector3 &vV) |
PLMATH_API void | GetScale (float &fX, float &fY, float &fZ) const |
Extracts the scale vector from the matrix as good as possible. | |
Vector3 | GetScale () const |
void | GetScale (float fV[]) const |
void | SetTranslationMatrix (float fX, float fY, float fZ) |
Sets a translation matrix. | |
void | SetTranslationMatrix (const Vector3 &vV) |
void | GetTranslation (float &fX, float &fY, float &fZ) const |
Vector3 | GetTranslation () const |
void | GetTranslation (float fV[]) const |
void | SetTranslation (float fX=0.0f, float fY=0.0f, float fZ=0.0f) |
void | SetTranslation (const Vector3 &vV) |
void | SetTranslation (const float fV[]) |
PLMATH_API void | FromEulerAngleX (float fAngleX) |
Sets an x axis rotation matrix by using one given Euler angle. | |
PLMATH_API void | FromEulerAngleY (float fAngleY) |
Sets an y axis rotation matrix by using one given Euler angle. | |
PLMATH_API void | FromEulerAngleZ (float fAngleZ) |
Sets an z axis rotation matrix by using one given Euler angle. | |
PLMATH_API void | ToAxisAngle (float &fX, float &fY, float &fZ, float &fAngle) const |
Returns a rotation matrix as a selected axis and angle. | |
PLMATH_API void | FromAxisAngle (float fX, float fY, float fZ, float fAngle) |
Sets a rotation matrix by using a selected axis and angle. | |
Vector3 | GetXAxis () const |
Returns the x (left) axis. | |
Vector3 | GetYAxis () const |
Returns the y (up) axis. | |
Vector3 | GetZAxis () const |
Returns the z (forward) axis. | |
PLMATH_API void | ToAxis (Vector3 &vX, Vector3 &vY, Vector3 &vZ) const |
Returns the three axis of a rotation matrix (not normalized) | |
PLMATH_API void | FromAxis (const Vector3 &vX, const Vector3 &vY, const Vector3 &vZ) |
Sets a rotation matrix by using three given axis. | |
PLMATH_API Matrix4x4 & | LookAt (const Vector3 &vEye, const Vector3 &vAt, const Vector3 &vUp) |
Builds a look-at matrix. | |
PLMATH_API Matrix4x4 & | View (const Quaternion &qRotation, const Vector3 &vPosition) |
Builds a view matrix. | |
PLMATH_API Matrix4x4 & | FromQuatTrans (const Quaternion &qRotation, const Vector3 &vTranslation) |
Sets a matrix using a given quaternion and translation. | |
Matrix4x4 & | SetShearing (float fShearXY, float fShearXZ, float fShearYX, float fShearYZ, float fShearZX, float fShearZY) |
Sets a shearing matrix. | |
PLMATH_API Matrix4x4 & | SetReflection (const Plane &cPlane) |
Sets a matrix that reflects the coordinate system about a plane. | |
PLMATH_API Matrix4x4 & | SetShadowProjection (const Vector4 &vLight, const Plane &cPlane) |
Sets a shadow projection matrix. | |
PLMATH_API void | RestrictedProjection (const Vector2 &vStartPos, const Vector2 &vEndPos, int nX, int nY, int nWidth, int nHeight) |
Creates a projection matrix that restricts drawing to a small region of the given viewport. | |
PLMATH_API Matrix4x4 & | Perspective (float fWidth, float fHeight, float fZNear, float fZFar) |
Builds a perspective projection matrix. | |
PLMATH_API Matrix4x4 & | PerspectiveFov (float fFov, float fAspect, float fZNear, float fZFar) |
Builds a perspective projection matrix based on a field of view. | |
PLMATH_API Matrix4x4 & | PerspectiveInfinite (float fWidth, float fHeight, float fZNear) |
Builds an infinite perspective projection matrix. | |
PLMATH_API Matrix4x4 & | PerspectiveFovInfinite (float fFov, float fAspect, float fZNear) |
Builds an infinite perspective projection matrix based on a field of view. | |
PLMATH_API Matrix4x4 & | PerspectiveOffCenter (float fL, float fR, float fB, float fT, float fZNear, float fZFar) |
Builds a customized, perspective projection matrix. | |
PLMATH_API Matrix4x4 & | Ortho (float fWidth, float fHeight, float fZNear, float fZFar) |
Builds a orthogonal projection matrix. | |
PLMATH_API Matrix4x4 & | OrthoOffCenter (float fL, float fR, float fT, float fB, float fZNear, float fZFar) |
Builds a customized, orthogonal projection matrix. | |
Public Attributes | |
union { | |
float fM [16] | |
One dimensional array representation. | |
struct { | |
float xx | |
float yx | |
float zx | |
float wx | |
float xy | |
float yy | |
float zy | |
float wy | |
float xz | |
float yz | |
float zz | |
float wz | |
float xw | |
float yw | |
float zw | |
float ww | |
} | |
Direct element representation. | |
struct { | |
float fM44 [4][4] | |
} | |
Two dimensional array representation. | |
}; | |
Some direct matrix accesses. | |
Static Public Attributes | |
static PLMATH_API const Matrix4x4 | Zero |
static PLMATH_API const Matrix4x4 | Identity |
4x4 matrix
PLMath::Matrix4x4::Matrix4x4 | ( | ) | [inline] |
Default constructor setting an identity matrix.
PLMath::Matrix4x4::Matrix4x4 | ( | const float | fS[] | ) | [inline] |
PLMATH_API PLMath::Matrix4x4::Matrix4x4 | ( | const Matrix3x3 & | mM | ) |
PLMATH_API PLMath::Matrix4x4::Matrix4x4 | ( | const Matrix3x4 & | mM | ) |
PLMath::Matrix4x4::Matrix4x4 | ( | const Matrix4x4 & | mM | ) | [inline] |
PLMath::Matrix4x4::Matrix4x4 | ( | float | fXX, |
float | fXY, | ||
float | fXZ, | ||
float | fXW, | ||
float | fYX, | ||
float | fYY, | ||
float | fYZ, | ||
float | fYW, | ||
float | fZX, | ||
float | fZY, | ||
float | fZZ, | ||
float | fZW, | ||
float | fWX, | ||
float | fWY, | ||
float | fWZ, | ||
float | fWW | ||
) | [inline] |
PLMath::Matrix4x4::~Matrix4x4 | ( | ) | [inline] |
PLMATH_API bool PLMath::Matrix4x4::operator== | ( | const Matrix3x4 & | mM | ) | const |
3x4: The last row is compared with (0, 0, 0, 1)
PLMATH_API bool PLMath::Matrix4x4::operator== | ( | const Matrix4x4 & | mM | ) | const |
PLMATH_API bool PLMath::Matrix4x4::operator!= | ( | const Matrix3x4 & | mM | ) | const |
3x4: The last row is compared with (0, 0, 0, 1)
PLMATH_API bool PLMath::Matrix4x4::operator!= | ( | const Matrix4x4 & | mM | ) | const |
PLMATH_API bool PLMath::Matrix4x4::CompareScale | ( | const Matrix4x4 & | mM, |
float | fEpsilon = Math::Epsilon |
||
) | const |
PLMATH_API bool PLMath::Matrix4x4::CompareTranslation | ( | const Matrix4x4 & | mM, |
float | fEpsilon = Math::Epsilon |
||
) | const |
PLMATH_API bool PLMath::Matrix4x4::CompareRotation | ( | const Matrix4x4 & | mM, |
float | fEpsilon = Math::Epsilon |
||
) | const |
Matrix4x4 & PLMath::Matrix4x4::operator= | ( | const float | fS[] | ) | [inline] |
void PLMath::Matrix4x4::operator+= | ( | const Matrix4x4 & | mM | ) | [inline] |
Matrix4x4 PLMath::Matrix4x4::operator- | ( | ) | const [inline] |
void PLMath::Matrix4x4::operator-= | ( | const Matrix4x4 & | mM | ) | [inline] |
Matrix4x4 PLMath::Matrix4x4::operator* | ( | float | fS | ) | const [inline] |
void PLMath::Matrix4x4::operator*= | ( | float | fS | ) | [inline] |
A 4x4*3x4 matrix multiplication is NOT defined, so we use the given 3x4 matrix with a fourth row (0, 0, 0, 1) which result in a 4x4*4x4 matrix multiplication which is allowed
void PLMath::Matrix4x4::operator*= | ( | const Matrix3x4 & | mM | ) | [inline] |
void PLMath::Matrix4x4::operator*= | ( | const Matrix4x4 & | mM | ) | [inline] |
Matrix4x4 PLMath::Matrix4x4::operator/ | ( | float | fS | ) | const [inline] |
void PLMath::Matrix4x4::operator/= | ( | float | fS | ) | [inline] |
float PLMath::Matrix4x4::operator[] | ( | int | nIndex | ) | const [inline] |
float & PLMath::Matrix4x4::operator[] | ( | int | nIndex | ) | [inline] |
float PLMath::Matrix4x4::operator() | ( | PLCore::uint32 | nRow = 0 , |
PLCore::uint32 | nColumn = 0 |
||
) | const [inline] |
float & PLMath::Matrix4x4::operator() | ( | PLCore::uint32 | nRow = 0 , |
PLCore::uint32 | nColumn = 0 |
||
) | [inline] |
PLMath::Matrix4x4::operator float * | ( | ) | [inline] |
PLMath::Matrix4x4::operator const float * | ( | ) | const [inline] |
bool PLMath::Matrix4x4::IsZero | ( | ) | const [inline] |
Returns whether or not this matrix is the zero matrix using an epsilon environment.
bool PLMath::Matrix4x4::IsTrueZero | ( | ) | const [inline] |
Returns whether or not this matrix is truly the zero matrix.
Returns whether or not this matrix is truely the zero matrix.
void PLMath::Matrix4x4::SetZero | ( | ) | [inline] |
Sets a zero matrix.
| 0 0 0 0 | | 0 0 0 0 | | 0 0 0 0 | | 0 0 0 0 |
bool PLMath::Matrix4x4::IsIdentity | ( | ) | const [inline] |
Returns whether or not this matrix is the identity matrix using an epsilon environment.
bool PLMath::Matrix4x4::IsTrueIdentity | ( | ) | const [inline] |
Returns whether or not this matrix is truly the identity matrix.
Returns whether or not this matrix is truely the identity matrix.
void PLMath::Matrix4x4::SetIdentity | ( | ) | [inline] |
Sets an identity matrix.
| 1 0 0 0 | | 0 1 0 0 | | 0 0 1 0 | | 0 0 0 1 |
PLMATH_API void PLMath::Matrix4x4::Set | ( | float | fXX, |
float | fXY, | ||
float | fXZ, | ||
float | fXW, | ||
float | fYX, | ||
float | fYY, | ||
float | fYZ, | ||
float | fYW, | ||
float | fZX, | ||
float | fZY, | ||
float | fZZ, | ||
float | fZW, | ||
float | fWX, | ||
float | fWY, | ||
float | fWZ, | ||
float | fWW | ||
) |
Sets the elements of the matrix.
Vector4 PLMath::Matrix4x4::GetRow | ( | PLCore::uint8 | nRow | ) | const [inline] |
Returns a requested row.
[in] | nRow | Index of the row to return (0-3) |
| x y z w | <- Row 0 | 0 0 0 0 | | 0 0 0 0 | | 0 0 0 0 |
void PLMath::Matrix4x4::SetRow | ( | PLCore::uint8 | nRow, |
const Vector4 & | vRow | ||
) | [inline] |
Vector4 PLMath::Matrix4x4::GetColumn | ( | PLCore::uint8 | nColumn | ) | const [inline] |
Returns a requested column.
[in] | nColumn | Index of the column to return (0-3) |
| x 0 0 0 | | y 0 0 0 | | z 0 0 0 | | w 0 0 0 | ^ | Column 0
void PLMath::Matrix4x4::SetColumn | ( | PLCore::uint8 | nColumn, |
const Vector4 & | vColumn | ||
) | [inline] |
Sets a column.
[in] | nColumn | Index of the column to set (0-3) |
[in] | vColumn | Column vector |
bool PLMath::Matrix4x4::IsSymmetric | ( | ) | const [inline] |
Returns true if the matrix is symmetric.
Returns true if this matrix is symmetric.
bool PLMath::Matrix4x4::IsOrthogonal | ( | ) | const [inline] |
Returns true if this matrix is orthogonal.
bool PLMath::Matrix4x4::IsRotationMatrix | ( | ) | const [inline] |
Returns true if this matrix is a rotation matrix.
bool PLMath::Matrix4x4::IsRotationTranslationMatrix | ( | ) | const [inline] |
Returns true if this matrix is a rotation and translation matrix.
| x x x x | | x x x x | | x x x x | | 0 0 0 1 |
float PLMath::Matrix4x4::GetTrace | ( | ) | const [inline] |
Returns the trace of the matrix.
PLMATH_API float PLMath::Matrix4x4::GetDeterminant | ( | ) | const |
Returns the determinant of the matrix.
PLMATH_API void PLMath::Matrix4x4::Transpose | ( | ) |
Transpose this matrix.
M' = M ij ji | xx xy xz xw | | xx yx zx wx | | yx yy yz yw | the transpose is | xy yy zy wy | | zx zy zz zw | | xz yz zz wz | | wx wy wz ww | | xw yw zw ww |
PLMATH_API Matrix4x4 PLMath::Matrix4x4::GetTransposed | ( | ) | const |
PLMATH_API bool PLMath::Matrix4x4::Invert | ( | ) |
Inverts the matrix.
PLMATH_API Matrix4x4 PLMath::Matrix4x4::GetInverted | ( | ) | const |
Returns the inverse of the matrix.
PLMATH_API Vector3 PLMath::Matrix4x4::RotateVector | ( | float | fX, |
float | fY, | ||
float | fZ, | ||
bool | bUniformScale = false |
||
) | const |
Rotates a vector.
[in] | fX | X component of the vector to rotate |
[in] | fY | Y component of the vector to rotate |
[in] | fZ | Z component of the vector to rotate |
[in] | bUniformScale | Is this a uniform scale matrix? (all axis are scaled equally) If you know EXACTLY it's one, set this to 'true' to gain some more speed, else DON'T set to 'true'! |
PLMATH_API Vector3 PLMath::Matrix4x4::RotateVector | ( | const Vector3 & | vV, |
bool | bUniformScale = false |
||
) | const |
Rotates a vector.
[in] | vV | Vector to rotate |
[in] | bUniformScale | Is this a uniform scale matrix? (all axis are scaled equally) If you know EXACTLY it's one, set this to 'true' to gain some more speed, else DON'T set to 'true'! |
void PLMath::Matrix4x4::SetScaleMatrix | ( | float | fX, |
float | fY, | ||
float | fZ | ||
) | [inline] |
Sets a scale matrix.
[in] | fX | X scale |
[in] | fY | Y scale |
[in] | fZ | Z scale |
| x 0 0 0 | | 0 y 0 0 | | 0 0 z 0 | | 0 0 0 1 |
void PLMath::Matrix4x4::SetScaleMatrix | ( | const Vector3 & | vV | ) | [inline] |
PLMATH_API void PLMath::Matrix4x4::GetScale | ( | float & | fX, |
float & | fY, | ||
float & | fZ | ||
) | const |
Extracts the scale vector from the matrix as good as possible.
[out] | fX | Receives the x scale |
[out] | fY | Receives the y scale |
[out] | fZ | Receives the z scale |
Vector3 PLMath::Matrix4x4::GetScale | ( | ) | const [inline] |
void PLMath::Matrix4x4::GetScale | ( | float | fV[] | ) | const [inline] |
void PLMath::Matrix4x4::SetTranslationMatrix | ( | float | fX, |
float | fY, | ||
float | fZ | ||
) | [inline] |
Sets a translation matrix.
[in] | fX | X translation |
[in] | fY | Y translation |
[in] | fZ | Z translation |
| 1 0 0 x | | 0 1 0 y | | 0 0 1 z | | 0 0 0 1 |
void PLMath::Matrix4x4::SetTranslationMatrix | ( | const Vector3 & | vV | ) | [inline] |
void PLMath::Matrix4x4::GetTranslation | ( | float & | fX, |
float & | fY, | ||
float & | fZ | ||
) | const [inline] |
Vector3 PLMath::Matrix4x4::GetTranslation | ( | ) | const [inline] |
void PLMath::Matrix4x4::GetTranslation | ( | float | fV[] | ) | const [inline] |
void PLMath::Matrix4x4::SetTranslation | ( | float | fX = 0.0f , |
float | fY = 0.0f , |
||
float | fZ = 0.0f |
||
) | [inline] |
void PLMath::Matrix4x4::SetTranslation | ( | const Vector3 & | vV | ) | [inline] |
void PLMath::Matrix4x4::SetTranslation | ( | const float | fV[] | ) | [inline] |
PLMATH_API void PLMath::Matrix4x4::FromEulerAngleX | ( | float | fAngleX | ) |
Sets an x axis rotation matrix by using one given Euler angle.
[in] | fAngleX | Rotation angle around the x axis (in radian, between [0, Math::Pi2]) |
| 1 0 0 0 | RX = | 0 cos(a) -sin(a) 0 | | 0 sin(a) cos(a) 0 | | 0 0 0 1 |
PLMATH_API void PLMath::Matrix4x4::FromEulerAngleY | ( | float | fAngleY | ) |
Sets an y axis rotation matrix by using one given Euler angle.
[in] | fAngleY | Rotation angle around the y axis (in radian, between [0, Math::Pi2]) |
| cos(a) 0 sin(a) 0 | RY = | 0 1 0 0 | | -sin(a) 0 cos(a) 0 | | 0 0 0 1 |
PLMATH_API void PLMath::Matrix4x4::FromEulerAngleZ | ( | float | fAngleZ | ) |
Sets an z axis rotation matrix by using one given Euler angle.
[in] | fAngleZ | Rotation angle around the z axis (in radian, between [0, Math::Pi2]) |
| cos(a) -sin(a) 0 0 | RZ = | sin(a) cos(a) 0 0 | | 0 0 1 0 | | 0 0 0 1 |
PLMATH_API void PLMath::Matrix4x4::ToAxisAngle | ( | float & | fX, |
float & | fY, | ||
float & | fZ, | ||
float & | fAngle | ||
) | const |
Returns a rotation matrix as a selected axis and angle.
[out] | fX | Will receive the x component of the selected axis |
[out] | fY | Will receive the y component of the selected axis |
[out] | fZ | Will receive the z component of the selected axis |
[out] | fAngle | Will receive the rotation angle around the selected axis (in radian, between [0, Math::Pi]) |
PLMATH_API void PLMath::Matrix4x4::FromAxisAngle | ( | float | fX, |
float | fY, | ||
float | fZ, | ||
float | fAngle | ||
) |
Sets a rotation matrix by using a selected axis and angle.
[in] | fX | X component of the selected axis |
[in] | fY | Y component of the selected axis |
[in] | fZ | Z component of the selected axis |
[in] | fAngle | Rotation angle around the selected axis (in radian, between [0, Math::Pi]) |
Vector3 PLMath::Matrix4x4::GetXAxis | ( | ) | const [inline] |
Returns the x (left) axis.
| x 0 0 0 | | y 0 0 0 | | z 0 0 0 | | 0 0 0 1 |
Vector3 PLMath::Matrix4x4::GetYAxis | ( | ) | const [inline] |
Returns the y (up) axis.
| 0 x 0 0 | | 0 y 0 0 | | 0 z 0 0 | | 0 0 0 1 |
Vector3 PLMath::Matrix4x4::GetZAxis | ( | ) | const [inline] |
Returns the z (forward) axis.
| 0 0 x 0 | | 0 0 y 0 | | 0 0 z 0 | | 0 0 0 1 |
PLMATH_API void PLMath::Matrix4x4::ToAxis | ( | Vector3 & | vX, |
Vector3 & | vY, | ||
Vector3 & | vZ | ||
) | const |
Returns the three axis of a rotation matrix (not normalized)
[out] | vX | Will receive the x axis |
[out] | vY | Will receive the y axis |
[out] | vZ | Will receive the z axis |
| vX.x vY.x vZ.x 0 | | vX.y vY.y vZ.y 0 | | vX.z vY.z vZ.z 0 | | 0 0 0 1 |
PLMATH_API void PLMath::Matrix4x4::FromAxis | ( | const Vector3 & | vX, |
const Vector3 & | vY, | ||
const Vector3 & | vZ | ||
) |
Sets a rotation matrix by using three given axis.
[in] | vX | X axis |
[in] | vY | Y axis |
[in] | vZ | Z axis |
PLMATH_API Matrix4x4& PLMath::Matrix4x4::LookAt | ( | const Vector3 & | vEye, |
const Vector3 & | vAt, | ||
const Vector3 & | vUp | ||
) |
Builds a look-at matrix.
[in] | vEye | Eye position |
[in] | vAt | Camera look-at target |
[in] | vUp | Current world's up, usually [0, 1, 0] |
PLMATH_API Matrix4x4& PLMath::Matrix4x4::View | ( | const Quaternion & | qRotation, |
const Vector3 & | vPosition | ||
) |
Builds a view matrix.
[in] | qRotation | Rotation quaternion |
[in] | vPosition | Position vector |
| RotT.xx RotT.xy RotT.xz T.x | | RotT.yx RotT.yy RotT.yz T.y | | RotT.zx RotT.zy RotT.zz T.z | | 0 0 0 1 |
RotT = Transposed(Rot) T = -(Transposed(Rot) * Pos)
PLMATH_API Matrix4x4& PLMath::Matrix4x4::FromQuatTrans | ( | const Quaternion & | qRotation, |
const Vector3 & | vTranslation | ||
) |
Sets a matrix using a given quaternion and translation.
[in] | qRotation | Rotation quaternion |
[in] | vTranslation | Translation vector |
Matrix4x4 & PLMath::Matrix4x4::SetShearing | ( | float | fShearXY, |
float | fShearXZ, | ||
float | fShearYX, | ||
float | fShearYZ, | ||
float | fShearZX, | ||
float | fShearZY | ||
) | [inline] |
Sets a shearing matrix.
[in] | fShearXY | Shear X by Y |
[in] | fShearXZ | Shear X by Z |
[in] | fShearYX | Shear Y by X |
[in] | fShearYZ | Shear Y by Z |
[in] | fShearZX | Shear Z by X |
[in] | fShearZY | Shear Z by Y |
| 1 fShearYX fShearZX 0 | | fShearXY 1 fShearZY 0 | | fShearXZ fShearYZ 1 0 | | 0 0 0 1 |
PLMATH_API Matrix4x4& PLMath::Matrix4x4::SetReflection | ( | const Plane & | cPlane | ) |
Sets a matrix that reflects the coordinate system about a plane.
[in] | cPlane | Reflection plane (must be normalized!) |
| -2*cPlane.a*cPlane.a+1 -2*cPlane.a*cPlane.b -2*cPlane.a*cPlane.c -2*cPlane.a*cPlane.d | | -2*cPlane.b*cPlane.a -2*cPlane.b*cPlane.b+1 -2*cPlane.b*cPlane.c -2*cPlane.b*cPlane.d | | -2*cPlane.c*cPlane.a -2*cPlane.c*cPlane.b -2*cPlane.c*cPlane.c+1 -2*cPlane.c*cPlane.d | | 0 0 0 1 |
PLMATH_API Matrix4x4& PLMath::Matrix4x4::SetShadowProjection | ( | const Vector4 & | vLight, |
const Plane & | cPlane | ||
) |
Sets a shadow projection matrix.
[in] | vLight | Light source position (if the light is directional, the w value should be 0) |
[in] | cPlane | Plane where to project the shadow onto |
| fDot-vLight.x*cPlane.a -vLight.x*cPlane.b -vLight.x*cPlane.c -vLight.x*cPlane.d |
| -vLight.y*cPlane.a fDot-vLight.y*cPlane.b -vLight.y*cPlane.c -vLight.y*cPlane.d |
| -vLight.z*cPlane.a -vLight.z*cPlane.b fDot-vLight.z*cPlane.c -vLight.z*cPlane.d |
| -vLight.w*cPlane.a -vLight.w*cPlane.b -vLight.w*cPlane.c fDot-vLight.w*cPlane.d |
where:
float fDot = cPlane.a*vLight.x + cPlane.b*vLight.y + cPlane.c*vLight.z + cPlane.d*vLight.w;
PLMATH_API void PLMath::Matrix4x4::RestrictedProjection | ( | const Vector2 & | vStartPos, |
const Vector2 & | vEndPos, | ||
int | nX, | ||
int | nY, | ||
int | nWidth, | ||
int | nHeight | ||
) |
Creates a projection matrix that restricts drawing to a small region of the given viewport.
[in] | vStartPos | Region start position |
[in] | vEndPos | Region end position |
[in] | nX | X component of the pixel coordinate of the upper-left corner of the viewport |
[in] | nY | Y component of the pixel coordinate of the upper-left corner of the viewport |
[in] | nWidth | Width of the clip volume, in pixels |
[in] | nHeight | Height of the clip volume, in pixels |
PLMATH_API Matrix4x4& PLMath::Matrix4x4::Perspective | ( | float | fWidth, |
float | fHeight, | ||
float | fZNear, | ||
float | fZFar | ||
) |
Builds a perspective projection matrix.
[in] | fWidth | Width of the view volume at the near view-plane |
[in] | fHeight | Height of the view volume at the near view-plane |
[in] | fZNear | Z-value of the near view-plane (always positive) |
[in] | fZFar | Z-value of the far view-plane (always positive) |
| 2*fZNear/fWidth 0 0 0 | | 0 2*fZNear/fHeight 0 0 | | 0 0 fZFar/(fZNear-fZFar) fZNear*fZFar/(fZNear-fZFar) | | 0 0 -1 0 |
PLMATH_API Matrix4x4& PLMath::Matrix4x4::PerspectiveFov | ( | float | fFov, |
float | fAspect, | ||
float | fZNear, | ||
float | fZFar | ||
) |
Builds a perspective projection matrix based on a field of view.
[in] | fFov | The field of view angle in the y direction (in radian) |
[in] | fAspect | The aspect ratio that determines the field of view in the x-direction The aspect ratio is the ratio of x (width) to y (height) (width/height) |
[in] | fZNear | The distance from the viewer to the near clipping plane (always positive) |
[in] | fZFar | The distance from the viewer to the far clipping plane (always positive) |
| e/fAspect 0 0 0 | | 0 e 0 0 | | 0 0 (fZFar+fZNear)/(fZNear-fZFar) (2*fZNear*fZFar)/(fZNear-fZFar) | | 0 0 -1 0 | where: float e = 1/tanf(fFov/2); // Focal length
PLMATH_API Matrix4x4& PLMath::Matrix4x4::PerspectiveInfinite | ( | float | fWidth, |
float | fHeight, | ||
float | fZNear | ||
) |
Builds an infinite perspective projection matrix.
[in] | fWidth | Width of the view volume at the near view-plane |
[in] | fHeight | Height of the view volume at the near view-plane |
[in] | fZNear | Z-value of the near view-plane (always positive) |
| 2*fZNear/fWidth 0 0 0 | | 0 2*fZNear/fHeight 0 0 | | 0 0 -1 -2*fZNear | | 0 0 -1 0 |
PLMATH_API Matrix4x4& PLMath::Matrix4x4::PerspectiveFovInfinite | ( | float | fFov, |
float | fAspect, | ||
float | fZNear | ||
) |
Builds an infinite perspective projection matrix based on a field of view.
[in] | fFov | The field of view angle in the y direction (in radian) |
[in] | fAspect | The aspect ratio that determines the field of view in the x-direction The aspect ratio is the ratio of x (width) to y (height) (width/height) |
[in] | fZNear | The distance from the viewer to the near clipping plane (always positive) |
| e/fAspect 0 0 0 | | 0 e 0 0 | | 0 0 -1 -2*fZNear | | 0 0 -1 0 | where: float e = 1/tanf(fFov/2); // Focal length
PLMATH_API Matrix4x4& PLMath::Matrix4x4::PerspectiveOffCenter | ( | float | fL, |
float | fR, | ||
float | fB, | ||
float | fT, | ||
float | fZNear, | ||
float | fZFar | ||
) |
Builds a customized, perspective projection matrix.
[in] | fL | Minimum x-value of view volume |
[in] | fR | Maximum x-value of view volume |
[in] | fT | Maximum y-value of view volume |
[in] | fB | Minimum y-value of view volume |
[in] | fZNear | Minimum z-value of the view volume |
[in] | fZFar | Maximum z-value of the view volume |
| 2*fZNear/(fR-fL) 0 (fL+fR)/(fR-fL) 0 | | 0 2*fZNear/(fT-fB) (fT+fB)/(fT-fB) 0 | | 0 0 fZFar/(fZNear-fZFar) fZNear*fZFar/(fZNear-fZFar) | | 0 0 -1 0 |
PLMATH_API Matrix4x4& PLMath::Matrix4x4::Ortho | ( | float | fWidth, |
float | fHeight, | ||
float | fZNear, | ||
float | fZFar | ||
) |
Builds a orthogonal projection matrix.
[in] | fWidth | Width of the view volume |
[in] | fHeight | Height of the view volume |
[in] | fZNear | Minimum z-value of the view volume |
[in] | fZFar | Maximum z-value of the view volume |
| 2/fWidth 0 0 0 | | 0 2/fHeight 0 0 | | 0 0 1/(fZNear-fZFar) fZNear/(fZNear-fZFar) | | 0 0 0 1 |
PLMATH_API Matrix4x4& PLMath::Matrix4x4::OrthoOffCenter | ( | float | fL, |
float | fR, | ||
float | fT, | ||
float | fB, | ||
float | fZNear, | ||
float | fZFar | ||
) |
Builds a customized, orthogonal projection matrix.
[in] | fL | Minimum x-value of view volume |
[in] | fR | Maximum x-value of view volume |
[in] | fT | Maximum y-value of view volume |
[in] | fB | Minimum y-value of view volume |
[in] | fZNear | Minimum z-value of the view volume |
[in] | fZFar | Maximum z-value of the view volume |
| 2/(fR-fL) 0 0 (fL+fR)/(fL-fR) | | 0 2/(fT-fB) 0 (fT+fB)/(fB-fT) | | 0 0 1/(fZNear-fZFar) fZNear/(fZNear-fZFar) | | 0 0 0 1 |
PLMATH_API const Matrix4x4 PLMath::Matrix4x4::Zero [static] |
Zero matrix
PLMATH_API const Matrix4x4 PLMath::Matrix4x4::Identity [static] |
Identity matrix
float PLMath::Matrix4x4::fM[16] |
One dimensional array representation.
| 0 4 8 12 | | 1 5 9 13 | | 2 6 10 14 | | 3 7 11 15 |
float PLMath::Matrix4x4::xx |
float PLMath::Matrix4x4::yx |
float PLMath::Matrix4x4::zx |
float PLMath::Matrix4x4::wx |
float PLMath::Matrix4x4::xy |
float PLMath::Matrix4x4::yy |
float PLMath::Matrix4x4::zy |
float PLMath::Matrix4x4::wy |
float PLMath::Matrix4x4::xz |
float PLMath::Matrix4x4::yz |
float PLMath::Matrix4x4::zz |
float PLMath::Matrix4x4::wz |
float PLMath::Matrix4x4::xw |
float PLMath::Matrix4x4::yw |
float PLMath::Matrix4x4::zw |
float PLMath::Matrix4x4::ww |
float PLMath::Matrix4x4::fM44[4][4] |
union { ... } |
Some direct matrix accesses.
|