4 dimensional floating point matrix More...
Public Member Functions | |
void | Zero (void) noexcept |
Clear out a 4D matrix. | |
void | Identity (void) noexcept |
Initialize a 4D matrix so that it is inert. | |
void | Set (const Matrix4D_t *pInput) noexcept |
Copy the matrix. | |
void | Set (const FixedMatrix4D_t *pInput) noexcept |
Convert a fixed point matrix into a floating point matrix. | |
void | Set (const Matrix3D_t *pInput) noexcept |
Copy a Matrix3D_t to a Matrix4D_t. | |
void | SetYaw (float fYaw) noexcept |
Initialize a rotation matrix with radians for yaw (Y) | |
void | SetPitch (float fPitch) noexcept |
Initialize a rotation matrix with radians for pitch (X) | |
void | SetRoll (float fRoll) noexcept |
Initialize a rotation matrix with radians for roll (Z) | |
void | SetYXZ (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a rotation matrix in the order of Y, X and Z. | |
void | SetYZX (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a rotation matrix in the order of Y, Z and X. | |
void | SetXYZ (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a rotation matrix in the order of X, Y and Z. | |
void | SetXZY (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a rotation matrix in the order of X, Z and Y. | |
void | SetZYX (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a rotation matrix in the order of Z, Y and X. | |
void | SetZXY (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a rotation matrix in the order of Z, X and Y. | |
void | SetTranslate (float fX, float fY, float fZ) noexcept |
Create a 4D translation matrix. | |
void | SetFromQuaternion (const Vector4D_t *pInput) noexcept |
Convert a quaternion to a 4x4 matrix. | |
void | TransposeSetYaw (float fYaw) noexcept |
Initialize a rotation matrix with radians for yaw (Y) | |
void | TransposeSetPitch (float fPitch) noexcept |
Initialize a rotation matrix with radians for pitch (X) | |
void | TransposeSetRoll (float fRoll) noexcept |
Initialize a rotation matrix with radians for roll (Z) | |
void | TransposeSetYXZ (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a transposed rotation matrix in the order of Y, X and Z. | |
void | TransposeSetYZX (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a transposed rotation matrix in the order of Y, Z and X. | |
void | TransposeSetXYZ (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a transposed rotation matrix in the order of X, Y and Z. | |
void | TransposeSetXZY (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a transposed rotation matrix in the order of X, Z and Y. | |
void | TransposeSetZYX (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a transposed rotation matrix in the order of Z, Y and X. | |
void | TransposeSetZXY (float fYaw, float fPitch, float fRoll) noexcept |
Initialize a transposed rotation matrix in the order of Z, X and Y. | |
void | TransposeSetFromQuaternion (const Vector4D_t *pInput) noexcept |
Convert a quaternion to a transposed 4x4 matrix. | |
void | SetScale (float fX, float fY, float fZ) noexcept |
Create a 4D scale matrix. | |
void | SetScale (float fX, float fY, float fZ, float fW) noexcept |
Create a 4D scale matrix. | |
void | SetFrustum (float fLeft, float fRight, float fBottom, float fTop, float fNear, float fFar) noexcept |
Create a transposed 4D projection matrix. | |
void | TransposeSetFrustum (float fLeft, float fRight, float fBottom, float fTop, float fNear, float fFar) noexcept |
Create a 4D projection matrix. | |
void | SetOrtho (float fLeft, float fRight, float fBottom, float fTop, float fNear, float fFar) noexcept |
Create a transposed orthogonal 4D projection matrix. | |
void | TransposeSetOrtho (float fLeft, float fRight, float fBottom, float fTop, float fNear, float fFar) noexcept |
Create an orthogonal 4D projection matrix. | |
void | SetPerspective (float fFieldOfViewY, float fAspect, float fNear, float fFar) noexcept |
Create a 4D perspective matrix. | |
void | TransposeSetPerspective (float fFieldOfViewY, float fAspect, float fNear, float fFar) noexcept |
Create a 4D perspective matrix. | |
void | Transpose (void) noexcept |
Perform a matrix transposition. | |
void | Transpose (const Matrix4D_t *pInput) noexcept |
Perform a matrix transposition. | |
void | GetXRow (Vector3D_t *pOutput) const noexcept |
Return the X row from a matrix. | |
void | GetXRow (Vector4D_t *pOutput) const noexcept |
Return the X row from a matrix. | |
void | GetYRow (Vector3D_t *pOutput) const noexcept |
Return the Y row from a matrix. | |
void | GetYRow (Vector4D_t *pOutput) const noexcept |
Return the Y row from a matrix. | |
void | GetZRow (Vector3D_t *pOutput) const noexcept |
Return the Z row from a matrix. | |
void | GetZRow (Vector4D_t *pOutput) const noexcept |
Return the Z row from a matrix. | |
void | GetWRow (Vector3D_t *pOutput) const noexcept |
Return the W row from a matrix. | |
void | GetWRow (Vector4D_t *pOutput) const noexcept |
Return the W row from a matrix. | |
void | GetXColumn (Vector3D_t *pOutput) const noexcept |
Return the X column from a matrix. | |
void | GetXColumn (Vector4D_t *pOutput) const noexcept |
Return the X column from a matrix. | |
void | GetYColumn (Vector3D_t *pOutput) const noexcept |
Return the Y column from a matrix. | |
void | GetYColumn (Vector4D_t *pOutput) const noexcept |
Return the Y column from a matrix. | |
void | GetZColumn (Vector3D_t *pOutput) const noexcept |
Return the Z column from a matrix. | |
void | GetZColumn (Vector4D_t *pOutput) const noexcept |
Return the Z column from a matrix. | |
void | GetWColumn (Vector3D_t *pOutput) const noexcept |
Return the W column from a matrix. | |
void | GetWColumn (Vector4D_t *pOutput) const noexcept |
Return the W column from a matrix. | |
void | SetXRow (const Vector3D_t *pInput) noexcept |
Set the X row of a matrix. | |
void | SetXRow (const Vector4D_t *pInput) noexcept |
Set the X row of a matrix. | |
void | SetYRow (const Vector3D_t *pInput) noexcept |
Set the Y row of a matrix. | |
void | SetYRow (const Vector4D_t *pInput) noexcept |
Set the Y row of a matrix. | |
void | SetZRow (const Vector3D_t *pInput) noexcept |
Set the Z row of a matrix. | |
void | SetZRow (const Vector4D_t *pInput) noexcept |
Set the Z row of a matrix. | |
void | SetWRow (const Vector3D_t *pInput) noexcept |
Set the W row of a matrix. | |
void | SetWRow (const Vector4D_t *pInput) noexcept |
Set the W row of a matrix. | |
void | SetXColumn (const Vector3D_t *pInput) noexcept |
Set the X column of a matrix. | |
void | SetXColumn (const Vector4D_t *pInput) noexcept |
Set the X column of a matrix. | |
void | SetYColumn (const Vector3D_t *pInput) noexcept |
Set the Y column of a matrix. | |
void | SetYColumn (const Vector4D_t *pInput) noexcept |
Set the Y column of a matrix. | |
void | SetZColumn (const Vector3D_t *pInput) noexcept |
Set the Z column of a matrix. | |
void | SetZColumn (const Vector4D_t *pInput) noexcept |
Set the Z column of a matrix. | |
void | SetWColumn (const Vector3D_t *pInput) noexcept |
Set the W column of a matrix. | |
void | SetWColumn (const Vector4D_t *pInput) noexcept |
Set the W column of a matrix. | |
void | Multiply (const Matrix4D_t *pInput) noexcept |
Perform a matrix multiply against this matrix. | |
void | Multiply (const Matrix4D_t *pInput1, const Matrix4D_t *pInput2) noexcept |
Perform a matrix multiply. | |
void | Multiply (float fScale) noexcept |
Perform a matrix multiply by a scalar. | |
void | Multiply (const Matrix4D_t *pInput, float fScale) noexcept |
Initialize with a matrix multiplied by a scalar. | |
void | Multiply (float fScaleX, float fScaleY, float fScaleZ) noexcept |
Multiply by an X,Y and Z scale. | |
void | Multiply (const Matrix4D_t *pInput, float fScaleX, float fScaleY, float fScaleZ) noexcept |
Multiply by an X,Y and Z scale into a copy. | |
void | Multiply (float fScaleX, float fScaleY, float fScaleZ, float fScaleW) noexcept |
Multiply by an X, Y, Z and W scale. | |
void | Multiply (const Matrix4D_t *pInput, float fScaleX, float fScaleY, float fScaleZ, float fScaleW) noexcept |
Multiply by an X, Y, Z and W scale. | |
void | Multiply3x3 (float fInput) noexcept |
Perform a 3x3 matrix multiply by a scalar. | |
void | Multiply3x3 (const Matrix4D_t *pInput, float fInput) noexcept |
Perform a 3x3 matrix multiply by a scalar. | |
void | TransposeMultiply (float fScaleX, float fScaleY, float fScaleZ) noexcept |
Multiply by an X,Y and Z scale. | |
void | TransposeMultiply (const Matrix4D_t *pInput, float fScaleX, float fScaleY, float fScaleZ) noexcept |
Multiply by an X,Y and Z scale into a copy. | |
void | TransposeMultiply (float fScaleX, float fScaleY, float fScaleZ, float fScaleW) noexcept |
Multiply by an X, Y, Z, and W scale. | |
void | TransposeMultiply (const Matrix4D_t *pInput, float fScaleX, float fScaleY, float fScaleZ, float fScaleW) noexcept |
Multiply by an X, Y, Z, and W scale. | |
void | Transform (Vector3D_t *pInput) const noexcept |
Multiply a vector by a matrix. | |
void | Transform (Vector4D_t *pInput) const noexcept |
Multiply a vector by a matrix. | |
void | Transform (Vector3D_t *pOutput, const Vector3D_t *pInput) const noexcept |
Multiply a vector by a matrix. | |
void | Transform (Vector4D_t *pOutput, const Vector4D_t *pInput) const noexcept |
Multiply a vector by a matrix. | |
void | TransposeTransform (Vector3D_t *pInput) const noexcept |
Multiply a vector by a transposed matrix. | |
void | TransposeTransform (Vector4D_t *pInput) const noexcept |
Multiply a vector by a transposed matrix. | |
void | TransposeTransform (Vector3D_t *pOutput, const Vector3D_t *pInput) const noexcept |
Multiply a vector by a transposed matrix. | |
void | TransposeTransform (Vector4D_t *pOutput, const Vector4D_t *pInput) const noexcept |
Multiply a vector by a transposed matrix. | |
void | Transform3x3 (Vector3D_t *pInput) const noexcept |
Multiply a vector by a matrix without adding W. | |
void | Transform3x3 (Vector3D_t *pOutput, const Vector3D_t *pInput) const noexcept |
Multiply a vector by a matrix without adding W. | |
void | TransposeTransform3x3 (Vector3D_t *pInput) const noexcept |
Multiply a vector by a transposed matrix without adding W. | |
void | TransposeTransform3x3 (Vector3D_t *pOutput, const Vector3D_t *pInput) const noexcept |
Multiply a vector by a transposed matrix without adding W. | |
void | Yaw (float fYaw) noexcept |
Rotate a matrix in the Y axis (Yaw) | |
void | Pitch (float fPitch) noexcept |
Rotate a matrix in the X axis (Pitch) | |
void | Roll (float fRoll) noexcept |
Rotate a matrix in the Z axis (Roll) | |
void | Rotate (float fRadians, float fX, float fY, float fZ) noexcept |
Rotate a matrix in an arbitrary axis. | |
void | Translate (float fX, float fY, float fZ) noexcept |
Multiply the matrix by a generated translation matrix. | |
void | TransposeTranslate (float fX, float fY, float fZ) noexcept |
Multiply the matrix by a generated transposed translation matrix. | |
uint_t | AffineInverse (const Matrix4D_t *pInput) noexcept |
Generate an affine inverse of a matrix. | |
void | PerspectiveFovLH (float fFieldOfViewY, float fAspect, float fNear, float fFar) noexcept |
Create a 4D perspective matrix. | |
void | PerspectiveFovRH (float fFieldOfViewY, float fAspect, float fNear, float fFar) noexcept |
Create a 4D perspective matrix. | |
operator const float * () const noexcept | |
Convert to a const float pointer. | |
Public Attributes | |
Vector4D_t | x |
32 bit floating point X row for the 4D Matrix | |
Vector4D_t | y |
32 bit floating point Y row for the 4D Matrix | |
Vector4D_t | z |
32 bit floating point Z row for the 4D Matrix | |
Vector4D_t | w |
32 bit floating point W row for the 4D Matrix | |
4 dimensional floating point matrix
This 64 byte matrix contains x,y,z and w 32 bit floating point rows and columns. A set of common functions for simple 4 dimensional math are part of the structure.
It is expected to be 4 byte aligned and use scalar math. The members are hard coded to be "x", "y", "z" and "w" for maximum compatibility
|
noexcept |
Generate an affine inverse of a matrix.
Using the 3x3 sub-matrix, generate a determinate and use it to calculate the inverse of the 3x3 matrix. Adjust the translate component and then clear out the scale.
If the matrix cannot be inverted, FALSE is returned and the original matrix is copied as is.
pInput | Pointer to a matrix to affine invert. |
|
noexcept |
Return the W column from a matrix.
Copy the w column of a matrix into a user supplied Vector3D_t buffer.
x | y | z |
---|---|---|
xw | yw | zw |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
|
noexcept |
Return the W column from a matrix.
Copy the w column of a matrix into a user supplied Vector4D_t buffer.
x | y | z | w |
---|---|---|---|
xw | yw | zw | ww |
pOutput | Pointer to an uninitialized Vector4D_t structure to receive the data |
|
noexcept |
Return the W row from a matrix.
Copy the w row of a matrix into a user supplied Vector3D_t buffer.
x | y | z |
---|---|---|
wx | wy | wz |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
|
noexcept |
Return the W row from a matrix.
Copy the w row of a matrix into a user supplied Vector4D_t buffer.
x | y | z | w |
---|---|---|---|
wx | wy | wz | ww |
pOutput | Pointer to an uninitialized Vector4D_t structure to receive the data |
|
noexcept |
Return the X column from a matrix.
Copy the x column of a matrix into a user supplied Vector3D_t buffer.
x | y | z |
---|---|---|
xx | yx | zx |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
|
noexcept |
Return the X column from a matrix.
Copy the x column of a matrix into a user supplied Vector4D_t buffer.
x | y | z | w |
---|---|---|---|
xx | yx | zx | wx |
pOutput | Pointer to an uninitialized Vector4D_t structure to receive the data |
|
noexcept |
Return the X row from a matrix.
Copy the x row of a matrix into a user supplied Vector3D_t buffer.
x | y | z |
---|---|---|
xx | xy | xz |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
|
noexcept |
Return the X row from a matrix.
Copy the x row of a matrix into a user supplied Vector4D_t buffer.
x | y | z | w |
---|---|---|---|
xx | xy | xz | xw |
pOutput | Pointer to an uninitialized Vector4D_t structure to receive the data |
|
noexcept |
Return the Y column from a matrix.
Copy the y column of a matrix into a user supplied Vector3D_t buffer.
x | y | z |
---|---|---|
xy | yy | zy |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
|
noexcept |
Return the Y column from a matrix.
Copy the y column of a matrix into a user supplied Vector4D_t buffer.
x | y | z | w |
---|---|---|---|
xy | yy | zy | wy |
pOutput | Pointer to an uninitialized Vector4D_t structure to receive the data |
|
noexcept |
Return the Y row from a matrix.
Copy the y row of a matrix into a user supplied Vector3D_t buffer.
x | y | z |
---|---|---|
yx | yy | yz |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
|
noexcept |
Return the Y row from a matrix.
Copy the y row of a matrix into a user supplied Vector4D_t buffer.
x | y | z | w |
---|---|---|---|
yx | yy | yz | yw |
pOutput | Pointer to an uninitialized Vector4D_t structure to receive the data |
|
noexcept |
Return the Z column from a matrix.
Copy the z column of a matrix into a user supplied Vector3D_t buffer.
x | y | z |
---|---|---|
xz | yz | zz |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
|
noexcept |
Return the Z column from a matrix.
Copy the z column of a matrix into a user supplied Vector4D_t buffer.
x | y | z | w |
---|---|---|---|
xz | yz | zz | wz |
pOutput | Pointer to an uninitialized Vector4D_t structure to receive the data |
|
noexcept |
Return the Z row from a matrix.
Copy the z row of a matrix into a user supplied Vector3D_t buffer.
x | y | z |
---|---|---|
zx | zy | zz |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
|
noexcept |
Return the Z row from a matrix.
Copy the z row of a matrix into a user supplied Vector4D_t buffer.
x | y | z | w |
---|---|---|---|
zx | zy | zz | zw |
pOutput | Pointer to an uninitialized Vector4D_t structure to receive the data |
|
noexcept |
Initialize a 4D matrix so that it is inert.
Sets the x.x, y.y, z.z and w.w components to 1.0f, all others to 0.0f
x | y | z | w | |
---|---|---|---|---|
x | 1 | 0 | 0 | 0 |
y | 0 | 1 | 0 | 0 |
z | 0 | 0 | 1 | 0 |
w | 0 | 0 | 0 | 1 |
|
noexcept |
Perform a matrix multiply against this matrix.
Multiply this matrix against another one
Use this formula to create the final matrix, this matrix is matrix #1 and the input matrix is matrix #2
x | y | z | w | |
---|---|---|---|---|
x | (x.x*pInput->x.x)+(y.x*pInput->x.y)+(z.x*pInput->x.z)+(w.x*pInput->x.w) | (x.y*pInput->x.x)+(y.y*pInput->x.y)+(z.y*pInput->x.z)+(w.y*pInput->x.w) | (x.z*pInput->x.x)+(y.z*pInput->x.y)+(z.z*pInput->x.z)+(w.z*pInput->x.w) | (x.w*pInput->x.x)+(y.w*pInput->x.y)+(z.w*pInput->x.z)+(w.w*pInput->x.w) |
y | (x.x*pInput->y.x)+(y.x*pInput->y.y)+(z.x*pInput->y.z)+(w.x*pInput->y.w) | (x.y*pInput->y.x)+(y.y*pInput->y.y)+(z.y*pInput->y.z)+(w.y*pInput->y.w) | (x.z*pInput->y.x)+(y.z*pInput->y.y)+(z.z*pInput->y.z)+(w.z*pInput->y.w) | (x.w*pInput->y.x)+(y.w*pInput->y.y)+(z.w*pInput->y.z)+(w.w*pInput->y.w) |
z | (x.x*pInput->z.x)+(y.x*pInput->z.y)+(z.x*pInput->z.z)+(w.x*pInput->z.w) | (x.y*pInput->z.x)+(y.y*pInput->z.y)+(z.y*pInput->z.z)+(w.y*pInput->z.w) | (x.z*pInput->z.x)+(y.z*pInput->z.y)+(z.z*pInput->z.z)+(w.z*pInput->z.w) | (x.w*pInput->z.x)+(y.w*pInput->z.y)+(z.w*pInput->z.z)+(w.w*pInput->z.w) |
w | (x.x*pInput->w.x)+(y.x*pInput->w.y)+(z.x*pInput->z.z)+(w.x*pInput->w.w) | (x.y*pInput->w.x)+(y.y*pInput->w.y)+(z.y*pInput->z.z)+(w.y*pInput->w.w) | (x.z*pInput->w.x)+(y.z*pInput->w.y)+(z.z*pInput->z.z)+(w.z*pInput->w.w) | (x.w*pInput->w.x)+(y.w*pInput->w.y)+(z.w*pInput->z.z)+(w.w*pInput->w.w) |
pInput | Matrix to multiply against |
|
noexcept |
Initialize with a matrix multiplied by a scalar.
Multiply all values of the matrix by a scalar constant and store the result in this matrix
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | pInput->xx*fInput | pInput->xy*fInput | pInput->xz*fInput | pInput->xw*fInput |
y | pInput->yx*fInput | pInput->yy*fInput | pInput->yz*fInput | pInput->yw*fInput |
z | pInput->zx*fInput | pInput->zy*fInput | pInput->zz*fInput | pInput->zw*fInput |
w | pInput->wx*fInput | pInput->wy*fInput | pInput->wz*fInput | pInput->ww*fInput |
pInput | Pointer to Matrix to multiply |
fScale | Scalar value to multiply all values by |
|
noexcept |
Multiply by an X,Y and Z scale into a copy.
Using only the x.x, y.y, and z.z components of a simulated matrix, perform a matrix multiply quickly that would yield a multiplication vs a scale matrix and store the result in this Matrix4D_t
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | (pInput->x.x*fScaleX) | (pInput->x.y*fScaleX) | (pInput->x.z*fScaleX) | (pInput->x.w*fScaleX) |
y | (pInput->y.x*fScaleY) | (pInput->y.y*fScaleY) | (pInput->y.z*fScaleY) | (pInput->y.w*fScaleY) |
z | (pInput->z.x*fScaleZ) | (pInput->z.y*fScaleZ) | (pInput->z.z*fScaleZ) | (pInput->z.w*fScaleZ) |
w | (pInput->w.x*1.0f) | (pInput->w.y*1.0f) | pInput->w.z*1.0f) | (pInput->w.w*1.0f) |
pInput | Pointer to a valid Matrix4D_t to apply the scale to |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z scale value |
|
noexcept |
Multiply by an X, Y, Z and W scale.
Using only the x.x, y.y, z.z and w.w components of a simulated matrix, perform a matrix multiply quickly that would yield a multiplication vs a scale matrix and store the result in this Matrix4D_t
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | (pInput->x.x*fScaleX) | (pInput->x.y*fScaleX) | (pInput->x.z*fScaleX) | (pInput->x.w*fScaleX) |
y | (pInput->y.x*fScaleY) | (pInput->y.y*fScaleY) | (pInput->y.z*fScaleY) | (pInput->y.w*fScaleY) |
z | (pInput->z.x*fScaleZ) | (pInput->z.y*fScaleZ) | (pInput->z.z*fScaleZ) | (pInput->z.w*fScaleZ) |
w | (pInput->w.x*fScaleW) | (pInput->w.y*fScaleW) | (pInput->w.z*fScaleW) | (pInput->w.w*fScaleW) |
pInput | Pointer to a valid Matrix4D_t to apply the scale to |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z scale value |
fScaleW | W scale value |
|
noexcept |
Perform a matrix multiply.
Multiply two matrices together and store the result in this matrix.
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | (pInput1->x.x*pInput2->x.x)+(pInput1->y.x*pInput2->x.y)+(pInput1->z.x*pInput2->x.z)+(pInput1->w.x*pInput2->x.w) | (pInput1->x.y*pInput2->x.x)+(pInput1->y.y*pInput2->x.y)+(pInput1->z.y*pInput2->x.z)+(pInput1->w.y*pInput2->x.w) | (pInput1->x.z*pInput2->x.x)+(pInput1->y.z*pInput2->x.y)+(pInput1->z.z*pInput2->x.z)+(pInput1->w.z*pInput2->x.w) | (pInput1->x.w*pInput2->x.x)+(pInput1->y.w*pInput2->x.y)+(pInput1->z.w*pInput2->x.z)+(pInput1->w.w*pInput2->x.w) |
y | (pInput1->x.x*pInput2->y.x)+(pInput1->y.x*pInput2->y.y)+(pInput1->z.x*pInput2->y.z)+(pInput1->w.x*pInput2->y.w) | (pInput1->x.y*pInput2->y.x)+(pInput1->y.y*pInput2->y.y)+(pInput1->z.y*pInput2->y.z)+(pInput1->w.y*pInput2->y.w) | (pInput1->x.z*pInput2->y.x)+(pInput1->y.z*pInput2->y.y)+(pInput1->z.z*pInput2->y.z)+(pInput1->w.z*pInput2->y.w) | (pInput1->x.w*pInput2->y.x)+(pInput1->y.w*pInput2->y.y)+(pInput1->z.w*pInput2->y.z)+(pInput1->w.w*pInput2->y.w) |
z | (pInput1->x.x*pInput2->z.x)+(pInput1->y.x*pInput2->z.y)+(pInput1->z.x*pInput2->z.z)+(pInput1->w.x*pInput2->z.w) | (pInput1->x.y*pInput2->z.x)+(pInput1->y.y*pInput2->z.y)+(pInput1->z.y*pInput2->z.z)+(pInput1->w.y*pInput2->z.w) | (pInput1->x.z*pInput2->z.x)+(pInput1->y.z*pInput2->z.y)+(pInput1->z.z*pInput2->z.z)+(pInput1->w.z*pInput2->z.w) | (pInput1->x.w*pInput2->z.x)+(pInput1->y.w*pInput2->z.y)+(pInput1->z.w*pInput2->z.z)+(pInput1->w.w*pInput2->z.w) |
w | (pInput1->x.x*pInput2->w.x)+(pInput1->y.x*pInput2->w.y)+(pInput1->z.x*pInput2->z.z)+(pInput1->w.x*pInput2->w.w) | (pInput1->x.y*pInput2->w.x)+(pInput1->y.y*pInput2->w.y)+(pInput1->z.y*pInput2->z.z)+(pInput1->w.y*pInput2->w.w) | (pInput1->x.z*pInput2->w.x)+(pInput1->y.z*pInput2->w.y)+(pInput1->z.z*pInput2->z.z)+(pInput1->w.z*pInput2->w.w) | (pInput1->x.w*pInput2->w.x)+(pInput1->y.w*pInput2->w.y)+(pInput1->z.w*pInput2->z.z)+(pInput1->w.w*pInput2->w.w) |
pInput1 | Matrix to multiply from |
pInput2 | Matrix to multiply against |
|
noexcept |
Perform a matrix multiply by a scalar.
Multiply a scalar value to every element in the matrix.
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | xx*fInput | xy*fInput | xz*fInput | xw*fInput |
y | yx*fInput | yy*fInput | yz*fInput | yw*fInput |
z | zx*fInput | zy*fInput | zz*fInput | zw*fInput |
w | wx*fInput | wy*fInput | wz*fInput | ww*fInput |
fScale | Scalar value to multiply all values by |
|
noexcept |
Multiply by an X,Y and Z scale.
Using only the x.x, y.y, and z.z components of a simulated matrix, perform a matrix multiply quickly that would yield a multiplication vs a scale matrix
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | (x.x*fScaleX) | (x.y*fScaleX) | (x.z*fScaleX) | (x.w*fScaleX) |
y | (y.x*fScaleY) | (y.y*fScaleY) | (y.z*fScaleY) | (y.w*fScaleY) |
z | (z.x*fScaleZ) | (z.y*fScaleZ) | (z.z*fScaleZ) | (z.w*fScaleZ) |
w | (w.x*1.0f) | (w.y*1.0f) | (w.z*1.0f) | (w.w*1.0f) |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z scale value |
|
noexcept |
Multiply by an X, Y, Z and W scale.
Using only the x.x, y.y, z.z and w.w components of a simulated matrix, perform a matrix multiply quickly that would yield a multiplication vs a scale matrix
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | (x.x*fScaleX) | (x.y*fScaleX) | (x.z*fScaleX) | (x.w*fScaleX) |
y | (y.x*fScaleY) | (y.y*fScaleY) | (y.z*fScaleY) | (y.w*fScaleY) |
z | (z.x*fScaleZ) | (z.y*fScaleZ) | (z.z*fScaleZ) | (z.w*fScaleZ) |
w | (w.x*fScaleW) | (w.y*fScaleW) | (w.z*fScaleW) | (w.w*fScaleW) |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z scale value |
fScaleW | W scale value |
|
noexcept |
Perform a 3x3 matrix multiply by a scalar.
Multiply a scalar value to the 3x3 subset of a matrix (The equivalent of W equaling 1.0f)
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | pInput->xx*fInput | pInput->xy*fInput | pInput->xz*fInput | pInput->xw*1.0f |
y | pInput->yx*fInput | pInput->yy*fInput | pInput->yz*fInput | pInput->yw*1.0f |
z | pInput->zx*fInput | pInput->zy*fInput | pInput->zz*fInput | pInput->zw*1.0f |
w | pInput->wx*1.0f | pInput->wy*1.0f | pInput->wz*1.0f | pInput->ww*1.0f |
pInput | Pointer to Matrix to multiply |
fInput | Scalar value to multiply all values by |
|
noexcept |
Perform a 3x3 matrix multiply by a scalar.
Multiply a scalar value to the 3x3 subset of a matrix (The equivalent of W equaling 1.0f)
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | xx*fInput | xy*fInput | xz*fInput | xw*1.0f |
y | yx*fInput | yy*fInput | yz*fInput | yw*1.0f |
z | zx*fInput | zy*fInput | zz*fInput | zw*1.0f |
w | wx*1.0f | wy*1.0f | wz*1.0f | ww*1.0f |
fInput | Scalar value to multiply all values by |
|
inlinenoexcept |
Convert to a const float pointer.
This convenience operator converts the Matrix4D_t into a float pointer to pass to other APIs that treat this as an array of 32 bit floats.
|
noexcept |
Create a 4D perspective matrix.
Using a field of view, an aspect ratio (width/height) and a near/far range, create a left handed projection matrix.
fYScale = 1.0f / tan(fFieldOfViewY*0.5f);
x | y | z | w | |
---|---|---|---|---|
x | fYScale/fAspect | 0 | 0 | 0 |
y | 0 | fYScale | 0 | 0 |
z | 0 | 0 | fFar/(fFar-fNear) | 1 |
w | 0 | 0 | (-fNear * fFar) / (fFar-fNear) | 0 |
fFieldOfViewY | Angle of the field of view in radians |
fAspect | Aspect ratio of the screen |
fNear | Near clip plane |
fFar | Far clip plane |
|
noexcept |
Create a 4D perspective matrix.
Using a field of view, an aspect ratio (width/height) and a near/far range, create a right handed projection matrix.
fYScale = 1.0f / tan(fFieldOfViewY*0.5f);
x | y | z | w | |
---|---|---|---|---|
x | fYScale/fAspect | 0 | 0 | 0 |
y | 0 | fYScale | 0 | 0 |
z | 0 | 0 | fFar/(fNear-fFar) | -1 |
w | 0 | 0 | (fNear * fFar) / (fNear-fFar) | 0 |
fFieldOfViewY | Angle of the field of view in radians |
fAspect | Aspect ratio of the screen |
fNear | Near clip plane |
fFar | Far clip plane |
|
noexcept |
Rotate a matrix in the X axis (Pitch)
Given a X angle in radians, rotate the matrix accordingly
fCos = get_cosine(fPitch); fSin = get_sine(fPitch);
x | y | z | w | |
---|---|---|---|---|
x | x.x | x.y | x.z | x.w |
y | (z.x*fSin)+(y.x*fCos) | (z.y*fSin)+(y.y*fCos) | (z.z*fSin)+(y.z*fCos) | (z.w*fSin)+(y.w*fCos) |
z | (z.x*fCos)-(y.x*fSin) | (z.y*fCos)-(y.y*fSin) | (z.z*fCos)-(y.z*fSin) | (z.w*fCos)-(y.w*fSin) |
w | w.x | w.y | w.z | w.w |
fPitch | Angle in radians to pitch the matrix |
|
noexcept |
Rotate a matrix in the Z axis (Roll)
Given a Z angle in radians, rotate the matrix accordingly
fCos = get_cosine(fRoll); fSin = get_sine(fRoll);
x | y | z | w | |
---|---|---|---|---|
x | (y.x*fSin)+(x.x*fCos) | (y.y*fSin)+(x.y*fCos) | (y.z*fSin)+(x.z*fCos) | (y.w*fSin)+(x.w*fCos) |
y | (y.x*fCos)-(x.x*fSin) | (y.y*fCos)-(x.y*fSin) | (y.z*fCos)-(x.z*fSin) | (y.w*fCos)-(x.w*fSin) |
z | z.x | z.y | z.z | z.w |
w | w.x | w.y | w.z | w.w |
fRoll | Angle in radians to roll the matrix |
|
noexcept |
Rotate a matrix in an arbitrary axis.
Given a vector to determine direction and an angle in radians, rotate the matrix accordingly
fRadians | Angle in radians to roll the matrix |
fX | X value of the vector |
fY | Y value of the vector |
fZ | Z value of the vector |
|
noexcept |
Convert a fixed point matrix into a floating point matrix.
Using fixed_to_float(float *,Fixed32), convert all of the entries from a 4x4 16.16 fixed point matrix into a floating point matrix
pInput | Pointer to a valid FixedMatrix4D_t for conversion |
|
noexcept |
Copy a Matrix3D_t to a Matrix4D_t.
Copy a 3x3 matrix into this one.
x | y | z | w | |
---|---|---|---|---|
x | pInput->x.x | pInput->x.y | pInput->x.z | 0 |
y | pInput->y.x | pInput->y.y | pInput->y.z | 0 |
z | pInput->z.x | pInput->z.y | pInput->z.z | 0 |
w | 0 | 0 | 0 | 1 |
pInput | Pointer to a valid Matrix3D_t for copying |
|
noexcept |
Copy the matrix.
Copy a matrix into this one
pInput | Pointer to a valid Matrix4D_t for copying |
|
noexcept |
Convert a quaternion to a 4x4 matrix.
Here's the resulting matrix of math used using terms from the input quaternion
x | y | z | w | |
---|---|---|---|---|
x | 1-(2yy+2zz) | 2xy+2wz | 2xz-2wy | 0 |
y | 2xy-2wz | 1-(2xx+2zz) | 2yz+2wx | 0 |
z | 2xz+2wy | 2yz-2wx | 1-(2xx+2yy) | 0 |
w | 0 | 0 | 0 | 1 |
pInput | Pointer to a normalized quaternion |
|
noexcept |
Create a transposed 4D projection matrix.
Using a frustum, create a projection matrix in a format that OpenGL can use directly. If a DirectX version is desired, call TransposeSetFrustum() instead.
x | y | z | w | |
---|---|---|---|---|
x | (fNear * 2.0f) / (fRight - fLeft) | 0 | 0 | 0 |
y | 0 | (fNear * 2.0f) / (fTop - fBottom) | 0 | 0 |
z | (fRight + fLeft) / (fRight - fLeft) | (fTop + fBottom) / (fTop - fBottom) | -(fFar+fNear) / (fFar - fNear) | -1 |
w | 0 | 0 | -(2.0f * fFar * fNear) / (fFar -fNear) | 0 |
fLeft | Leftmost X coordinate |
fRight | Rightmost X coordinate |
fBottom | Bottommost Y coordinate |
fTop | Topmost Y coordinate |
fNear | Near clip plane |
fFar | Far clip plane |
|
noexcept |
Create a transposed orthogonal 4D projection matrix.
Using a frustum, create an orthogonal matrix in a format that OpenGL can use directly. If a DirectX version is desired, call TransposeSetOrtho() instead.
x | y | z | w | |
---|---|---|---|---|
x | 2.0f / (fRight - fLeft) | 0 | 0 | 0 |
y | 0 | 2.0f / (fTop - fBottom) | 0 | 0 |
z | 0 | 0 | -2.0f / (fFar - fNear) | 0 |
w | -(fRight + fLeft) / (fRight - fLeft) | -(fTop + fBottom) / (fTop - fBottom) | -(Far + fNear) / (fFar - fNear) | 1 |
fLeft | Leftmost X coordinate |
fRight | Rightmost X coordinate |
fBottom | Bottommost Y coordinate |
fTop | Topmost Y coordinate |
fNear | Near clip plane |
fFar | Far clip plane |
|
noexcept |
Create a 4D perspective matrix.
Using a field of view and an aspect ratio (x/y), create a projection matrix in a format that OpenGL can use directly. If a DirectX version is desired, call TransposeSetPerspective() instead.
f = 1.0f / tan((fFieldOfViewY*g_fDegreesToRadians)*0.5f);
x | y | z | w | |
---|---|---|---|---|
x | f/fAspect | 0 | 0 | 0 |
y | 0 | f | 0 | 0 |
z | 0 | 0 | (fFar+fNear) / (fNear-fFar) | -1 |
w | 0 | 0 | (2.0f * fFar * fNear) / (fNear-fFar) | 0 |
fFieldOfViewY | Angle of the field of view in degrees |
fAspect | Aspect ratio of the screen |
fNear | Near clip plane |
fFar | Far clip plane |
|
noexcept |
Initialize a rotation matrix with radians for pitch (X)
x | y | z | w | |
---|---|---|---|---|
x | 1 | 0 | 0 | 0 |
y | 0 | cx | -sx | 0 |
z | 0 | sx | cx | 0 |
w | 0 | 0 | 0 | 1 |
fPitch | Pitch of the X in radians |
|
noexcept |
Initialize a rotation matrix with radians for roll (Z)
x | y | z | w | |
---|---|---|---|---|
x | cz | -sz | 0 | 0 |
y | sz | cz | 0 | 0 |
z | 0 | 0 | 1 | 0 |
w | 0 | 0 | 0 | 1 |
fRoll | Roll of the Z in radians |
|
noexcept |
Create a 4D scale matrix.
Sets the x.x, y.y and z.z components to the input values, w.w is set to 1.0f and all others are set to 0.0f
x | y | z | w | |
---|---|---|---|---|
x | fX | 0 | 0 | 0 |
y | 0 | fY | 0 | 0 |
z | 0 | 0 | fZ | 0 |
w | 0 | 0 | 0 | 1 |
fX | new x.x component |
fY | new y.y component |
fZ | new z.z component |
|
noexcept |
Create a 4D scale matrix.
Sets the x.x, y.y, z.z and w.w components to the input values and all others are set to 0.0f
x | y | z | w | |
---|---|---|---|---|
x | fX | 0 | 0 | 0 |
y | 0 | fY | 0 | 0 |
z | 0 | 0 | fZ | 0 |
w | 0 | 0 | 0 | fW |
fX | new x.x component |
fY | new y.y component |
fZ | new z.z component |
fW | new w.w component |
|
noexcept |
Create a 4D translation matrix.
Sets the w row to fX, fY and fZ and the rest of the values to that of an identity matrix.
x | y | z | w | |
---|---|---|---|---|
x | 1 | 0 | 0 | 0 |
y | 0 | 1 | 0 | 0 |
z | 0 | 0 | 1 | 0 |
w | fX | fY | fZ | 1 |
fX | new w.x component |
fY | new w.y component |
fZ | new w.z component |
|
noexcept |
Set the W column of a matrix.
Overwrite the W column of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | xy | xz | pInput->x |
y | yx | yy | yz | pInput->y |
z | zx | zy | zz | pInput->z |
w | wx | wy | wz | ww |
pInput | Pointer to a Vector3D_t structure that has the new W column |
|
noexcept |
Set the W column of a matrix.
Overwrite the W column of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | xy | xz | pInput->x |
y | yx | yy | yz | pInput->y |
z | zx | zy | zz | pInput->z |
w | wx | wy | wz | pInput->w |
pInput | Pointer to a Vector4D_t structure that has the new W column |
|
noexcept |
Set the W row of a matrix.
Overwrite the W row of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | xy | xz | xw |
y | yx | yy | yz | yw |
z | zx | zy | zz | zw |
w | pInput->x | pInput->y | pInput->z | ww |
pInput | Pointer to a Vector3D_t structure that has the new W row |
|
noexcept |
Set the W row of a matrix.
Overwrite the W row of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | xy | xz | xw |
y | yx | yy | yz | yw |
z | zx | zy | zz | zw |
w | pInput->x | pInput->y | pInput->z | pInput->w |
pInput | Pointer to a Vector4D_t structure that has the new W row |
|
noexcept |
Set the X column of a matrix.
Overwrite the X column of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | pInput->x | xy | xz | xw |
y | pInput->y | yy | yz | yw |
z | pInput->z | zy | zz | zw |
w | wx | wy | wz | ww |
pInput | Pointer to a Vector3D_t structure that has the new X column |
|
noexcept |
Set the X column of a matrix.
Overwrite the X column of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | pInput->x | xy | xz | xw |
y | pInput->y | yy | yz | yw |
z | pInput->z | zy | zz | zw |
w | pInput->w | wy | wz | ww |
pInput | Pointer to a Vector4D_t structure that has the new X column |
|
noexcept |
Set the X row of a matrix.
Overwrite the X row of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | pInput->x | pInput->y | pInput->z | xw |
y | yx | yy | yz | yw |
z | zx | zy | zz | zw |
w | wx | wy | wz | ww |
pInput | Pointer to a Vector3D_t structure that has the new X row |
|
noexcept |
Set the X row of a matrix.
Overwrite the X row of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | pInput->x | pInput->y | pInput->z | pInput->w |
y | yx | yy | yz | yw |
z | zx | zy | zz | zw |
w | wx | wy | wz | ww |
pInput | Pointer to a Vector4D_t structure that has the new X row |
|
noexcept |
Initialize a rotation matrix in the order of X, Y and Z.
Initialize a rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of X, Y and then Z.
x | y | z | w | |
---|---|---|---|---|
x | cy*cz | (-sy*sx*cz)+(cx*-sz) | (-sy*cx*cz)+(-sx*-sz) | 0 |
y | cy*sz | (cx*cz)+(-sy*sx*sz) | (-sx*cx)+(cy*sx*-sz) | 0 |
z | sy | cy*sx | cy*cx | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Initialize a rotation matrix in the order of X, Z and Y.
Initialize a rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of X, Z and then Y.
x | y | z | w | |
---|---|---|---|---|
x | cy*cz | (cx*-sz*cy)+(-sy*sx) | (-sx*-sz*cy)+(-sy*cx) | 0 |
y | sz | cx*cz | -sx*cz | 0 |
z | sy*cz | (sx*cy)+(sy*cx*-sz) | (cx*cy)+(sy*-sx*-sz) | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Initialize a rotation matrix with radians for yaw (Y)
x | y | z | w | |
---|---|---|---|---|
x | cy | 0 | -sy | 0 |
y | 0 | 1 | 0 | 0 |
z | sy | 0 | cy | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
|
noexcept |
Set the Y column of a matrix.
Overwrite the Y column of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | pInput->x | xz | xw |
y | yx | pInput->y | yz | yw |
z | zx | pInput->z | zz | zw |
w | wx | wy | wz | ww |
pInput | Pointer to a Vector3D_t structure that has the new Y column |
|
noexcept |
Set the Y column of a matrix.
Overwrite the Y column of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | pInput->x | xz | xw |
y | yx | pInput->y | yz | yw |
z | zx | pInput->z | zz | zw |
w | wx | pInput->w | wz | ww |
pInput | Pointer to a Vector4D_t structure that has the new Y column |
|
noexcept |
Set the Y row of a matrix.
Overwrite the Y row of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | xy | xz | xw |
y | pInput->x | pInput->y | pInput->z | yw |
z | zx | zy | zz | zw |
w | wx | wy | wz | ww |
pInput | Pointer to a Vector3D_t structure that has the new Y row |
|
noexcept |
Set the Y row of a matrix.
Overwrite the Y row of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | xy | xz | xw |
y | pInput->x | pInput->y | pInput->z | pInput->w |
z | zx | zy | zz | zw |
w | wx | wy | wz | ww |
pInput | Pointer to a Vector4D_t structure that has the new Y row |
|
noexcept |
Initialize a rotation matrix in the order of Y, X and Z.
Initialize a rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of Y, X and then Z.
x | y | z | w | |
---|---|---|---|---|
x | (cy*cz)+(sy*-sx*-sz) | cx*-sz | (-sy*cz)+(cy*-sx*-sz) | 0 |
y | (sy*-sx*cz)+(cy*sz) | cx*cz | (cy*-sx*cz)+(-sy*sz) | 0 |
z | sy*cx | sx | cy*cx | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Initialize a rotation matrix in the order of Y, Z and X.
Initialize a rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of Y, Z and then X.
x | y | z | w | |
---|---|---|---|---|
x | cy*cz | -sz | -sy*cz | 0 |
y | (cy*sz*cx)+(sy*-sx) | cx*cz | (-sy*sz*cx)+(cy*-sx) | 0 |
z | (sy*cx)+(cy*sx*sz) | sx*cz | (cy*cx)+(-sy*sx*sz) | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Set the Z column of a matrix.
Overwrite the Z column of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | xy | pInput->x | xw |
y | yx | yy | pInput->y | yw |
z | zx | zy | pInput->z | zw |
w | wx | wy | wz | ww |
pInput | Pointer to a Vector3D_t structure that has the new Z column |
|
noexcept |
Set the Z column of a matrix.
Overwrite the Z column of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | xy | pInput->x | xw |
y | yx | yy | pInput->y | yw |
z | zx | zy | pInput->z | zw |
w | wx | wy | pInput->w | ww |
pInput | Pointer to a Vector4D_t structure that has the new Z column |
|
noexcept |
Set the Z row of a matrix.
Overwrite the Z row of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | xy | xz | xw |
y | yx | yy | yz | yw |
z | pInput->x | pInput->y | pInput->z | zw |
w | wx | wy | wz | ww |
pInput | Pointer to a Vector3D_t structure that has the new Z row |
|
noexcept |
Set the Z row of a matrix.
Overwrite the Z row of the matrix with the input vector
x | y | z | w | |
---|---|---|---|---|
x | xx | xy | xz | xw |
y | yx | yy | yz | yw |
z | pInput->x | pInput->y | pInput->z | pInput->w |
w | wx | wy | wz | ww |
pInput | Pointer to a Vector4D_t structure that has the new Z row |
|
noexcept |
Initialize a rotation matrix in the order of Z, X and Y.
Initialize a rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of Z, X and then Y.
x | y | z | w | |
---|---|---|---|---|
x | (cz*cy)+(-sy*sx*sz) | (-sz*cy)+(-sy*sx*cz) | -sy*cx | 0 |
y | cx*sz | cx*cz | -sx | 0 |
z | (sx*sz*cy)+(sy*cz) | (sx*cz*cy)+(sy*-sz) | cy*cx | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Initialize a rotation matrix in the order of Z, Y and X.
Initialize a rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of Z, Y and then X.
x | y | z | w | |
---|---|---|---|---|
x | cy*cz | cy*-sz | -sy | 0 |
y | (sz*cx)+(sy*-sx*cz) | (cz*cx)+(sy*-sx*-sz) | cy*-sx | 0 |
z | (sy*cz*cx)+(sx*sz) | (sy*-sz*cx)+(sx*cz) | cy*cx | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Multiply a vector by a matrix.
Transform the point by the matrix
x | y | z |
---|---|---|
(xx*x)+(xy*y)+(xz*z)+(xw) | (yx*x)+(yy*y)+(yz*z)+(yw) | (zx*x)+(zy*y)+(zz*z)+(zw) |
pInput | Pointer to a Vector3D_t to transform against this matrix |
|
noexcept |
Multiply a vector by a matrix.
Transform the point by the matrix and store the result in an uninitialized Vector3D_t
x | y | z |
---|---|---|
(xx*x)+(xy*y)+(xz*z)+(xw) | (yx*x)+(yy*y)+(yz*z)+(yw) | (zx*x)+(zy*y)+(zz*z)+(zw) |
pInput | Pointer to a Vector3D_t to transform against this matrix |
pOutput | Pointer to an uninitialized Vector3D_t to store the result |
|
noexcept |
Multiply a vector by a matrix.
Transform the point by the matrix
x | y | z | w |
---|---|---|---|
(xx*x)+(xy*y)+(xz*z)+(xw*w) | (yx*x)+(yy*y)+(yz*z)+(yw*w) | (zx*x)+(zy*y)+(zz*z)+(zw*w) | (wx*x)+(wy*y)+(wz*z)+(ww*w) |
pInput | Pointer to a Vector4D_t to transform against this matrix |
|
noexcept |
Multiply a vector by a matrix.
Transform the point by the matrix and store the result in an uninitialized Vector4D_t
x | y | z | w |
---|---|---|---|
(xx*x)+(xy*y)+(xz*z)+(xw*w) | (yx*x)+(yy*y)+(yz*z)+(yw*w) | (zx*x)+(zy*y)+(zz*z)+(zw*w) | (wx*x)+(wy*y)+(wz*z)+(ww*w) |
pInput | Pointer to a Vector4D_t to transform against this matrix |
pOutput | Pointer to an uninitialized Vector4D_t to store the result |
|
noexcept |
Multiply a vector by a matrix without adding W.
Transform the point by the matrix only using the x, y and z terms
x | y | z |
---|---|---|
(xx*x)+(xy*y)+(xz*z) | (yx*x)+(yy*y)+(yz*z) | (zx*x)+(zy*y)+(zz*z) |
pInput | Pointer to a Vector3D_t to transform against this matrix |
|
noexcept |
Multiply a vector by a matrix without adding W.
Transform the point by the matrix only using the x, y and z terms and store the result in an uninitialized Vector3D_t
|x|y|z|w| |:–:|:–:|:–:|:–:| |(xx*x)+(xy*y)+(xz*z)|(yx*x)+(yy*y)+(yz*z)|(zx*x)+(zy*y)+(zz*z)|
pInput | Pointer to a Vector3D_t to transform against this matrix |
pOutput | Pointer to an uninitialized Vector3D_t to store the result |
|
noexcept |
Multiply the matrix by a generated translation matrix.
With an X, Y and Z for translation, apply a matrix multiply if a matrix was generated with SetTranslate(float,float,float).
x | y | z | w | |
---|---|---|---|---|
x | x.x | x.y | x.z | x.w |
y | y.x | y.y | y.z | y.w |
z | z.x | z.y | z.z | z.w |
w | (x.x*fX)+(y.x*fY)+(z.x*fZ)+w.x | (x.y*fX)+(y.y*fY)+(z.y*fZ)+w.y | (x.z*fX)+(y.z*fY)+(z.z*fZ)+w.z | (x.w*fX)+(y.w*fY)+(z.w*fZ)+w.w |
fX | X value of the temp translation matrix |
fY | Y value of the temp translation matrix |
fZ | Z value of the temp translation matrix |
|
noexcept |
Perform a matrix transposition.
Swap the entries to convert a right handed matrix to a left handed one and vice versa. The other three entries are copied. The destination matrix is assumed to be uninitialized.
x | y | z | w | |
---|---|---|---|---|
x | xx | yx | zx | wx |
y | xy | yy | zy | wy |
z | xz | yz | zz | wz |
w | xw | yw | zw | ww |
|
noexcept |
Perform a matrix transposition.
Swap the entries to convert a right handed matrix to a left handed one and vice versa. The matrix is assumed to be already initialized.
x | y | z | w | |
---|---|---|---|---|
x | xx | yx | zx | wx |
y | xy | yy | zy | wy |
z | xz | yz | zz | wz |
w | xw | yw | zw | ww |
|
noexcept |
Multiply by an X,Y and Z scale into a copy.
Using only the x.x, y.y, and z.z components of a simulated matrix, perform a matrix multiply quickly that would yield a multiplication vs a scale matrix and store the result in this Matrix4D_t
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | (pInput->x.x*fScaleX) | (pInput->x.y*fScaleY) | (pInput->x.z*fScaleZ) | (pInput->x.w*1.0f) |
y | (pInput->y.x*fScaleX) | (pInput->y.y*fScaleY) | (pInput->y.z*fScaleZ) | (pInput->y.w*1.0f) |
z | (pInput->z.x*fScaleX) | (pInput->z.y*fScaleY) | (pInput->z.z*fScaleZ) | (pInput->z.w*1.0f) |
w | (pInput->w.x*fScaleX) | (pInput->w.y*fScaleY) | (pInput->w.z*fScaleZ) | (pInput->w.w*1.0f) |
pInput | Pointer to a valid Matrix4D_t to apply the scale to |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z scale value |
|
noexcept |
Multiply by an X, Y, Z, and W scale.
Using only the x.x, y.y, z.z and w.w components of a simulated matrix, perform a matrix multiply quickly that would yield a multiplication vs a scale matrix and store the result in this Matrix4D_t
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | (pInput->x.x*fScaleX) | (pInput->x.y*fScaleY) | (pInput->x.z*fScaleZ) | (pInput->x.w*fScaleW) |
y | (pInput->y.x*fScaleX) | (pInput->y.y*fScaleY) | (pInput->y.z*fScaleZ) | (pInput->y.w*fScaleW) |
z | (pInput->z.x*fScaleX) | (pInput->z.y*fScaleY) | (pInput->z.z*fScaleZ) | (pInput->z.w*fScaleW) |
w | (pInput->w.x*fScaleX) | (pInput->w.y*fScaleY) | (pInput->w.z*fScaleZ) | (pInput->w.w*fScaleW) |
pInput | Pointer to a valid Matrix4D_t to apply the scale to |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z scale value |
fScaleW | W scale value |
|
noexcept |
Multiply by an X,Y and Z scale.
Using only the x.x, y.y, and z.z components of a simulated matrix, perform a matrix multiply quickly that would yield a multiplication vs a scale matrix
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | (x.x*fScaleX) | (x.y*fScaleY) | (x.z*fScaleZ) | (x.w*1.0f) |
y | (y.x*fScaleX) | (y.y*fScaleY) | (y.z*fScaleZ) | (y.w*1.0f) |
z | (z.x*fScaleX) | (z.y*fScaleY) | (z.z*fScaleZ) | (z.w*1.0f) |
w | (w.x*fScaleX) | (w.y*fScaleY) | (w.z*fScaleZ) | (w.w*1.0f) |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z scale value |
|
noexcept |
Multiply by an X, Y, Z, and W scale.
Using only the x.x, y.y, z.z and w.w components of a simulated matrix, perform a matrix multiply quickly that would yield a multiplication vs a scale matrix
Use this formula to create the final matrix
x | y | z | w | |
---|---|---|---|---|
x | (x.x*fScaleX) | (x.y*fScaleY) | (x.z*fScaleZ) | (x.w*fScaleW) |
y | (y.x*fScaleX) | (y.y*fScaleY) | (y.z*fScaleZ) | (y.w*fScaleW) |
z | (z.x*fScaleX) | (z.y*fScaleY) | (z.z*fScaleZ) | (z.w*fScaleW) |
w | (w.x*fScaleX) | (w.y*fScaleY) | (w.z*fScaleZ) | (w.w*fScaleW) |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z scale value |
fScaleW | W scale value |
|
noexcept |
Convert a quaternion to a transposed 4x4 matrix.
Here's the resulting matrix of math used using terms from the input quaternion
x | y | z | w | |
---|---|---|---|---|
x | 1-(2yy+2zz) | 2xy-2wz | 2xz+2wy | 0 |
y | 2xy+2wz | 1-(2xx+2zz) | 2yz-2wx | 0 |
z | 2xz-2wy | 2yz+2wx | 1-(2xx+2yy) | 0 |
w | 0 | 0 | 0 | 1 |
pInput | Pointer to a normalized quaternion |
|
noexcept |
Create a 4D projection matrix.
Using a frustum, create a projection matrix in a format that DirectX can use directly. If a OpenGL version is desired, call SetFrustum() instead.
x | y | z | w | |
---|---|---|---|---|
x | (fNear * 2.0f) / (fRight - fLeft) | 0 | (fRight + fLeft) / (fRight - fLeft) | 0 |
y | 0 | (fNear * 2.0f) / (fTop - fBottom) | (fTop + fBottom) / (fTop - fBottom) | 0 |
z | 0 | 0 | -(fFar+fNear) / (fFar - fNear) | -(2.0f * fFar * fNear) / (fFar - fNear) |
w | 0 | 0 | -1 | 0 |
fLeft | Leftmost X coordinate |
fRight | Rightmost X coordinate |
fBottom | Bottommost Y coordinate |
fTop | Topmost Y coordinate |
fNear | Near clip plane |
fFar | Far clip plane |
|
noexcept |
Create an orthogonal 4D projection matrix.
Using a frustum, create an orthogonal matrix in a format that DirectX can use directly. If an OpenGL version is desired, call SetOrtho() instead.
x | y | z | w | |
---|---|---|---|---|
x | 2.0f / (fRight - fLeft) | 0 | 0 | -(fRight + fLeft) / (fRight - fLeft) |
y | 0 | 2.0f / (fTop - fBottom) | 0 | -(fTop + fBottom) / (fTop - fBottom) |
z | 0 | 0 | -2.0f / (fFar - fNear) | -(Far + fNear) / (fFar - fNear) |
w | 0 | 0 | 0 | 1 |
fLeft | Leftmost X coordinate |
fRight | Rightmost X coordinate |
fBottom | Bottommost Y coordinate |
fTop | Topmost Y coordinate |
fNear | Near clip plane |
fFar | Far clip plane |
|
noexcept |
Create a 4D perspective matrix.
Using a field of view and an aspect ratio (x/y), create a projection matrix in a format that DirectX can use directly. If an OpenGL version is desired, call SetPerspective() instead.
f = 1.0f / tan((fFieldOfViewY*g_fDegreesToRadians)*0.5f);
x | y | z | w | |
---|---|---|---|---|
x | f/fAspect | 0 | 0 | 0 |
y | 0 | f | 0 | 0 |
z | 0 | 0 | (fFar+fNear) / (fNear-fFar) | (2.0f * fFar * fNear) / (fNear-fFar) |
w | 0 | 0 | -1 | 0 |
fFieldOfViewY | Angle of the field of view in degrees |
fAspect | Aspect ratio of the screen |
fNear | Near clip plane |
fFar | Far clip plane |
|
noexcept |
Initialize a rotation matrix with radians for pitch (X)
x | y | z | w | |
---|---|---|---|---|
x | 1 | 0 | 0 | 0 |
y | 0 | cx | sx | 0 |
z | 0 | -sx | cx | 0 |
w | 0 | 0 | 0 | 1 |
fPitch | Pitch of the X in radians |
|
noexcept |
Initialize a rotation matrix with radians for roll (Z)
x | y | z | w | |
---|---|---|---|---|
x | cz | sz | 0 | 0 |
y | -sz | cz | 0 | 0 |
z | 0 | 0 | 1 | 0 |
w | 0 | 0 | 0 | 1 |
fRoll | Roll of the Z in radians |
|
noexcept |
Initialize a transposed rotation matrix in the order of X, Y and Z.
Initialize a transposed rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of X, Y and then Z.
x | y | z | w | |
---|---|---|---|---|
x | cy*cz | (sy*-sx*cz)+(cx*sz) | (sy*cx*cz)+(sx*sz) | 0 |
y | cy*-sz | (cx*cz)+(sy*-sx*-sz) | (sx*cz)+(sy*cx*-sz) | 0 |
z | -sy | cy*-sx | cy*cx | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Initialize a transposed rotation matrix in the order of X, Z and Y.
Initialize a transposed rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of X, Z and then Y.
x | y | z | w | |
---|---|---|---|---|
x | cy*cz | (cx*sz*cy)+(sy*-sx) | (sx*sz*cy)+(sy*cx) | 0 |
y | -sz | cx*cz | sx*cz | 0 |
z | -sy*cz | (-sx*cy)+(-sy*cx*sz) | (cx*cy)+(-sy*sx*sz) | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Initialize a rotation matrix with radians for yaw (Y)
x | y | z | w | |
---|---|---|---|---|
x | cy | 0 | sy | 0 |
y | 0 | 1 | 0 | 0 |
z | -sy | 0 | cy | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
|
noexcept |
Initialize a transposed rotation matrix in the order of Y, X and Z.
Initialize a transposed rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of Y, X and then Z.
x | y | z | w | |
---|---|---|---|---|
x | (cy*cz)+(-sy*sx*sz) | cx*sz | (sy*cz)+(cy*sx*sz) | 0 |
y | (-sy*sx*cz)+(cy*-sz) | cx*cz | (cy*sx*cz)+(sy*-sz) | 0 |
z | -sy*cx | -sx | cy*cx | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Initialize a transposed rotation matrix in the order of Y, Z and X.
Initialize a transposed rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of Y, Z and then X.
x | y | z | w | |
---|---|---|---|---|
x | cy*cz | sz | sy*cz | 0 |
y | (cy*-sz*cx)+(-sy*sx) | cx*cz | (sy*-sz*cx)+(cy*sx) | 0 |
z | (-sy*cx)+(cy*-sx*-sz) | -sx*cz | (cy*cx)+(sy*-sx*-sz) | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Initialize a transposed rotation matrix in the order of Z, X and Y.
Initialize a transposed rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of Z, X and then Y.
x | y | z | w | |
---|---|---|---|---|
x | (cz*cy)+(sy*-sx*-sz) | (sz*cy)+(sy*-sx*cz) | sy*cx | 0 |
y | cx*-sz | cx*cz | sx | 0 |
z | (-sx*-sz*cy)+(-sy*cz) | (-sx*cz*cy)+(-sy*sz) | cy*cx | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Initialize a transposed rotation matrix in the order of Z, Y and X.
Initialize a transposed rotation matrix with radians for Yaw (Y), Pitch (X), and Roll (Z) in the order of Z, Y and then X.
x | y | z | w | |
---|---|---|---|---|
x | cy*cz | cy*sz | sy | 0 |
y | (-sz*cx)+(-sy*sx*cz) | (cz*cx)+(-sy*sx*sz) | cy*sx | 0 |
z | (-sy*cz*cx)+(-sx*-sz) | (-sy*sz*cx)+(-sx*cz) | cy*cx | 0 |
w | 0 | 0 | 0 | 1 |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
noexcept |
Multiply a vector by a transposed matrix.
Transform the point by the transposed matrix
x | y | z |
---|---|---|
(xx*x)+(yx*y)+(zx*z)+(wx) | (xy*x)+(yy*y)+(zy*z)+(wy) | (xz*x)+(yz*y)+(zz*z)+(wz) |
pInput | Pointer to a Vector3D_t to transform against this transposed matrix |
|
noexcept |
Multiply a vector by a transposed matrix.
Transform the point by the transposed matrix and store the result in an uninitialized Vector3D_t
x | y | z |
---|---|---|
(xx*x)+(yx*y)+(zx*z)+(wx) | (xy*x)+(yy*y)+(zy*z)+(wy) | (xz*x)+(yz*y)+(zz*z)+(wz) |
pInput | Pointer to a Vector3D_t to transform against this transposed matrix |
pOutput | Pointer to an uninitialized Vector3D_t to store the result |
|
noexcept |
Multiply a vector by a transposed matrix.
Transform the point by the transposed matrix
x | y | z | w |
---|---|---|---|
(xx*x)+(yx*y)+(zx*z)+(wx*w) | (xy*x)+(yy*y)+(zy*z)+(wy*w) | (xz*x)+(yz*y)+(zz*z)+(wz*w) | (xw*x)+(yw*y)+(zw*z)+(ww*w) |
pInput | Pointer to a Vector4D_t to transform against this transposed matrix |
|
noexcept |
Multiply a vector by a transposed matrix.
Transform the point by the transposed matrix and store the result in an uninitialized Vector4D_t
x | y | z | w |
---|---|---|---|
(xx*x)+(yx*y)+(zx*z)+(wx*w) | (xy*x)+(yy*y)+(zy*z)+(wy*w) | (xz*x)+(yz*y)+(zz*z)+(wz*w) | (xw*x)+(yw*y)+(zw*z)+(ww*w) |
pInput | Pointer to a Vector4D_t to transform against this transposed matrix |
pOutput | Pointer to an uninitialized Vector4D_t to store the result |
|
noexcept |
Multiply a vector by a transposed matrix without adding W.
Transform the point by the transposed matrix only using the x, y and z terms
|x|y|z| |:–:|:–:|:–:| |x|(xx*x)+(yx*y)+(zx*z)|(xy*x)+(yy*y)+(zy*z)|(xz*x)+(yz*y)+(zz*z)|
pInput | Pointer to a Vector3D_t to transform against this transposed matrix |
|
noexcept |
Multiply a vector by a transposed matrix without adding W.
Transform the point by the transposed matrix only using the x, y and z terms and store the result in an uninitialized Vector3D_t
|x|y|z|w| |:–:|:–:|:–:|:–:| |(xx*x)+(yx*y)+(zx*z)|(xy*x)+(yy*y)+(zy*z)|(xz*x)+(yz*y)+(zz*z)|
pInput | Pointer to a Vector3D_t to transform against this transposed matrix |
pOutput | Pointer to an uninitialized Vector3D_t to store the result |
|
noexcept |
Multiply the matrix by a generated transposed translation matrix.
With an X, Y and Z for translation, apply a matrix multiply if a matrix was generated with SetTranslate(float,float,float) and then Transpose()
x | y | z | w | |
---|---|---|---|---|
x | x.x | x.y | x.z | (x.x*fX)+(x.y*fY)+(x.z*fZ)+x.w |
y | y.x | y.y | y.z | (y.x*fX)+(y.y*fY)+(y.z*fZ)+y.w |
z | z.x | z.y | z.z | (z.x*fX)+(z.y*fY)+(z.z*fZ)+z.w |
w | w.x | w.y | w.z | (w.x*fX)+(w.y*fY)+(w.z*fZ)+w.w |
fX | X value of the temp translation matrix |
fY | Y value of the temp translation matrix |
fZ | Z value of the temp translation matrix |
|
noexcept |
Rotate a matrix in the Y axis (Yaw)
Given a Y angle in radians, rotate the matrix accordingly
fCos = get_cosine(fYaw); fSin = get_sine(fYaw);
x | y | z | w | |
---|---|---|---|---|
x | (z.x*fSin)+(x.x*fCos) | (z.y*fSin)+(x.y*fCos) | (z.z*fSin)+(x.z*fCos) | (z.w*fSin)+(x.w*fCos) |
y | y.x | y.y | y.z | y.w |
z | (z.x*fCos)-(x.x*fSin) | (z.y*fCos)-(x,y*fSin) | (z.z*fCos)-(x.z*fSin) | (z.w*fCos)-(x.w*fSin) |
w | w.x | w.y | w.z | w.w |
fYaw | Angle in radians to yaw the matrix |
|
noexcept |
Clear out a 4D matrix.
Set all of the entries to zero
x | y | z | w | |
---|---|---|---|---|
x | 0 | 0 | 0 | 0 |
y | 0 | 0 | 0 | 0 |
z | 0 | 0 | 0 | 0 |
w | 0 | 0 | 0 | 0 |
Vector4D_t Burger::Matrix4D_t::w |
32 bit floating point W row for the 4D Matrix
Vector4D_t Burger::Matrix4D_t::x |
32 bit floating point X row for the 4D Matrix
Vector4D_t Burger::Matrix4D_t::y |
32 bit floating point Y row for the 4D Matrix
Vector4D_t Burger::Matrix4D_t::z |
32 bit floating point Z row for the 4D Matrix