3 dimensional floating point matrix More...
Public Member Functions | |
void | Zero (void) |
Clear out a 3D matrix. | |
void | Identity (void) |
Initialize a 3D matrix so that it is inert. | |
void | Set (const Matrix3D_t *pInput) |
Copy the matrix. | |
void | Set (const FixedMatrix3D_t *pInput) |
Convert a fixed point matrix into a floating point matrix. | |
void | Set (const Matrix4D_t *pInput) |
Copy a Matrix4D_t to a Matrix3D_t. | |
void | SetYaw (float fYaw) |
Initialize a rotation matrix with radians for yaw (Y) | |
void | SetPitch (float fPitch) |
Initialize a rotation matrix with radians for pitch (X) | |
void | SetRoll (float fRoll) |
Initialize a rotation matrix with radians for roll (Z) | |
void | SetYXZ (float fYaw, float fPitch, float fRoll) |
Initialize a rotation matrix in the order of Y, X and Z. | |
void | SetYZX (float fYaw, float fPitch, float fRoll) |
Initialize a rotation matrix in the order of Y, Z and X. | |
void | SetXYZ (float fYaw, float fPitch, float fRoll) |
Initialize a rotation matrix in the order of X, Y and Z. | |
void | SetXZY (float fYaw, float fPitch, float fRoll) |
Initialize a rotation matrix in the order of X, Z and Y. | |
void | SetZYX (float fYaw, float fPitch, float fRoll) |
Initialize a rotation matrix in the order of Z, Y and X. | |
void | SetZXY (float fYaw, float fPitch, float fRoll) |
Initialize a rotation matrix in the order of Z, X and Y. | |
void | SetTranslate (float fX, float fY) |
Create a 2D Translation matrix. | |
void | SetFromQuaternion (const Vector4D_t *pInput) |
Convert a quaternion to a 3x3 matrix. | |
void | TransposeSetYaw (float fYaw) |
Initialize a rotation matrix with radians for yaw (Y) | |
void | TransposeSetPitch (float fPitch) |
Initialize a rotation matrix with radians for pitch (X) | |
void | TransposeSetRoll (float fRoll) |
Initialize a rotation matrix with radians for roll (Z) | |
void | TransposeSetYXZ (float fYaw, float fPitch, float fRoll) |
Initialize a transposed rotation matrix in the order of Y, X and Z. | |
void | TransposeSetYZX (float fYaw, float fPitch, float fRoll) |
Initialize a transposed rotation matrix in the order of Y, Z and X. | |
void | TransposeSetXYZ (float fYaw, float fPitch, float fRoll) |
Initialize a transposed rotation matrix in the order of X, Y and Z. | |
void | TransposeSetXZY (float fYaw, float fPitch, float fRoll) |
Initialize a transposed rotation matrix in the order of X, Z and Y. | |
void | TransposeSetZYX (float fYaw, float fPitch, float fRoll) |
Initialize a transposed rotation matrix in the order of Z, Y and X. | |
void | TransposeSetZXY (float fYaw, float fPitch, float fRoll) |
Initialize a transposed rotation matrix in the order of Z, X and Y. | |
void | TransposeSetFromQuaternion (const Vector4D_t *pInput) |
Convert a quaternion to a transposed 3x3 matrix. | |
void | SetScale (float fX, float fY, float fZ) noexcept |
Create a 3D scale matrix. | |
void | Transpose (void) |
Perform a matrix transposition. | |
void | Transpose (const Matrix3D_t *pInput) |
Perform a matrix transposition. | |
void | GetXRow (Vector3D_t *pOutput) const |
Return the X row from a matrix. | |
void | GetYRow (Vector3D_t *pOutput) const |
Return the Y row from a matrix. | |
void | GetZRow (Vector3D_t *pOutput) const |
Return the Z row from a matrix. | |
void | GetXColumn (Vector3D_t *pOutput) const |
Return the X column from a matrix. | |
void | GetYColumn (Vector3D_t *pOutput) const |
Return the Y column from a matrix. | |
void | GetZColumn (Vector3D_t *pOutput) const |
Return the Z column from a matrix. | |
void | SetXRow (const Vector3D_t *pInput) |
Set the X row of a matrix. | |
void | SetXRow (float fX, float fY, float fZ) |
Set the X row of a matrix. | |
void | SetYRow (const Vector3D_t *pInput) |
Set the Y row of a matrix. | |
void | SetYRow (float fX, float fY, float fZ) |
Set the Y row of a matrix. | |
void | SetZRow (const Vector3D_t *pInput) |
Set the Z row of a matrix. | |
void | SetZRow (float fX, float fY, float fZ) |
Set the Z row of a matrix. | |
void | SetXColumn (const Vector3D_t *pInput) |
Set the X column of a matrix. | |
void | SetXColumn (float fX, float fY, float fZ) |
Set the X column of a matrix. | |
void | SetYColumn (const Vector3D_t *pInput) |
Set the Y column of a matrix. | |
void | SetYColumn (float fX, float fY, float fZ) |
Set the Y column of a matrix. | |
void | SetZColumn (const Vector3D_t *pInput) |
Set the Z column of a matrix. | |
void | SetZColumn (float fX, float fY, float fZ) |
Set the Z column of a matrix. | |
void | Multiply (const Matrix3D_t *pInput) |
Perform a matrix multiply against this matrix. | |
void | Multiply (const Matrix3D_t *pInput1, const Matrix3D_t *pInput2) noexcept |
Perform a matrix multiply. | |
void | Multiply (float fScale) |
Multiply all entries by a scalar. | |
void | Multiply (const Matrix3D_t *pInput, float fScale) |
Initialize with a matrix multiplied by a scalar. | |
void | Multiply (float fScaleX, float fScaleY, float fScaleZ) |
Multiply by an X,Y and Z scale. | |
void | Multiply (const Matrix3D_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) |
Multiply by an X,Y and Z scale. | |
void | TransposeMultiply (const Matrix3D_t *pInput, float fScaleX, float fScaleY, float fScaleZ) noexcept |
Multiply by an X,Y and Z scale into a copy. | |
void | Transform (Vector3D_t *pInput) const |
Multiply a vector by a matrix. | |
void | Transform (Vector3D_t *pOutput, const Vector3D_t *pInput) const |
Multiply a vector by a matrix. | |
void | TransformAdd (Vector3D_t *pInput, const Vector3D_t *pTranslate) const |
Transform a vector and then add a point. | |
void | TransformAdd (Vector3D_t *pOutput, const Vector3D_t *pInput, const Vector3D_t *pTranslate) const |
Transform a vector and then add a point. | |
void | TransposeTransform (Vector3D_t *pInput) const |
Multiply a vector by a transposed matrix. | |
void | TransposeTransform (Vector3D_t *pOutput, const Vector3D_t *pInput) const |
Multiply a vector by a transposed matrix. | |
void | TransposeTransformAdd (Vector3D_t *pInput, const Vector3D_t *pTranslate) const |
Transform a vector and then add a point. | |
void | TransposeTransformAdd (Vector3D_t *pOutput, const Vector3D_t *pInput, const Vector3D_t *pTranslate) const |
Transform a vector and then add a point. | |
uint_t | AffineInverse (const Matrix3D_t *pInput) |
Perform an affine inverse. | |
void | Yaw (float fYaw) |
Rotate a matrix in the Y axis (Yaw) | |
void | Pitch (float fPitch) |
Rotate a matrix in the X axis (Pitch) | |
void | Roll (float fRoll) |
Rotate a matrix in the Z axis (Roll) | |
operator const float * () const | |
Convert to a const float pointer. | |
Public Attributes | |
Vector3D_t | x |
32 bit floating point X row for the 3D Matrix | |
Vector3D_t | y |
32 bit floating point Y row for the 3D Matrix | |
Vector3D_t | z |
32 bit floating point Z row for the 3D Matrix | |
3 dimensional floating point matrix
This 36 byte matrix contains x,y and z 32 bit floating point rows and columns. A set of common functions for simple 3 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" and "z" for maximum compatibility
uint_t BURGER_API Burger::Matrix3D_t::AffineInverse | ( | const Matrix3D_t * | pInput | ) |
Perform an affine inverse.
Given an input matrix, perform an affine inverse and store it in this instance.
pInput | Pointer to a matrix to obtain an inverse from |
void BURGER_API Burger::Matrix3D_t::GetXColumn | ( | Vector3D_t * | pOutput | ) | const |
Return the X column from a matrix.
Copy the x column of a matrix into a user supplied Vector3D_t buffer.
x | xx |
---|---|
y | yx |
z | zx |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
void BURGER_API Burger::Matrix3D_t::GetXRow | ( | Vector3D_t * | pOutput | ) | const |
Return the X row from a matrix.
Copy the x row of a matrix into a user supplied Vector3D_t buffer.
x | xx |
---|---|
y | xy |
z | xz |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
void BURGER_API Burger::Matrix3D_t::GetYColumn | ( | Vector3D_t * | pOutput | ) | const |
Return the Y column from a matrix.
Copy the y column of a matrix into a user supplied Vector3D_t buffer.
x | xy |
---|---|
y | yy |
z | zy |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
void BURGER_API Burger::Matrix3D_t::GetYRow | ( | Vector3D_t * | pOutput | ) | const |
Return the Y row from a matrix.
Copy the y row of a matrix into a user supplied Vector3D_t buffer.
x | yx |
---|---|
y | yy |
z | yz |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
void BURGER_API Burger::Matrix3D_t::GetZColumn | ( | Vector3D_t * | pOutput | ) | const |
Return the Z column from a matrix.
Copy the z column of a matrix into a user supplied Vector3D_t buffer.
x | xz |
---|---|
y | yz |
z | zz |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
void BURGER_API Burger::Matrix3D_t::GetZRow | ( | Vector3D_t * | pOutput | ) | const |
Return the Z row from a matrix.
Copy the z row of a matrix into a user supplied Vector3D_t buffer.
x | zx |
---|---|
y | zy |
z | zz |
pOutput | Pointer to an uninitialized Vector3D_t structure to receive the data |
void BURGER_API Burger::Matrix3D_t::Identity | ( | void | ) |
Initialize a 3D matrix so that it is inert.
Sets the x.x, y.y and z.z components to 1.0f, all others to 0.0f
x | y | z | |
---|---|---|---|
x | 1 | 0 | 0 |
y | 0 | 1 | 0 |
z | 0 | 0 | 1 |
void BURGER_API Burger::Matrix3D_t::Multiply | ( | const Matrix3D_t * | pInput | ) |
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 | |
---|---|---|---|
x | (xx1*xx2)+(yx1*xy2)+(zx1*xz2) | (xy1*xx2)+(yy1*xy2)+(zy1*xz2) | (xz1*xx2)+(yz1*xy2)+(zz1*xz2) |
y | (xx1*yx2)+(yx1*yy2)+(zx1*yz2) | (xy1*yx2)+(yy1*yy2)+(zy1*yz2) | (xz1*yx2)+(yz1*yy2)+(zz1*yz2) |
z | (xx1*zx2)+(yx1*zy2)+(zx1*zz2) | (xy1*zx2)+(yy1*zy2)+(zy1*zz2) | (xz1*zx2)+(yz1*zy2)+(zz1*zz2) |
pInput | Matrix to multiply against |
void BURGER_API Burger::Matrix3D_t::Multiply | ( | const Matrix3D_t * | pInput, |
float | fScale ) |
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 | |
---|---|---|---|
x | (pInput->x.x*fScale) | (pInput->x.y*fScale) | (pInput->x.z*fScale) |
y | (pInput->y.x*fScale) | (pInput->y.y*fScale) | (pInput->y.z*fScale) |
z | (pInput->z.x*fScale) | (pInput->z.y*fScale) | (pInput->z.z*fScale) |
pInput | Pointer to Matrix to multiply |
fScale | Scalar to multiply all entries 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 Matrix3D_t
Use this formula to create the final matrix
x | y | z | |
---|---|---|---|
x | (pInput->x.x*fScaleX) | (pInput->x.y*fScaleX) | (pInput->x.z*fScaleX) |
y | (pInput->y.x*fScaleY) | (pInput->y.y*fScaleY) | (pInput->y.z*fScaleY) |
z | (pInput->z.x*fScaleZ) | (pInput->z.y*fScaleZ) | (pInput->z.z*fScaleZ) |
pInput | Pointer to a valid Matrix3D_t to apply the scale to |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z 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 | |
---|---|---|---|
x | (xx1*xx2)+(yx1*xy2)+(zx1*xz2) | (xy1*xx2)+(yy1*xy2)+(zy1*xz2) | (xz1*xx2)+(yz1*xy2)+(zz1*xz2) |
y | (xx1*yx2)+(yx1*yy2)+(zx1*yz2) | (xy1*yx2)+(yy1*yy2)+(zy1*yz2) | (xz1*yx2)+(yz1*yy2)+(zz1*yz2) |
z | (xx1*zx2)+(yx1*zy2)+(zx1*zz2) | (xy1*zx2)+(yy1*zy2)+(zy1*zz2) | (xz1*zx2)+(yz1*zy2)+(zz1*zz2) |
pInput1 | Matrix to multiply from |
pInput2 | Matrix to multiply against |
void BURGER_API Burger::Matrix3D_t::Multiply | ( | float | fScale | ) |
Multiply all entries by a scalar.
Multiply all values in the matrix by a scalar constant
Use this formula to create the final matrix
x | y | z | |
---|---|---|---|
x | (x.x*fScale) | (x.y*fScale) | (x.z*fScale) |
y | (y.x*fScale) | (y.y*fScale) | (y.z*fScale) |
z | (z.x*fScale) | (z.y*fScale) | (z.z*fScale) |
fScale | Scalar to multiply all entries by |
void BURGER_API Burger::Matrix3D_t::Multiply | ( | float | fScaleX, |
float | fScaleY, | ||
float | fScaleZ ) |
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 | |
---|---|---|---|
x | (x.x*fScaleX) | (x.y*fScaleX) | (x.z*fScaleX) |
y | (y.x*fScaleY) | (y.y*fScaleY) | (y.z*fScaleY) |
z | (z.x*fScaleZ) | (z.y*fScaleZ) | (z.z*fScaleZ) |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z scale value |
|
inline |
Convert to a const float pointer.
This convenience operator converts the Matrix3D_t into a float pointer to pass to other APIs that treat this as an array of 32 bit floats.
void BURGER_API Burger::Matrix3D_t::Pitch | ( | float | fPitch | ) |
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 | |
---|---|---|---|
x | x.x | x.y | x.z |
y | (z.x*fSin)+(y.x*fCos) | (z.y*fSin)+(y.y*fCos) | (z.z*fSin)+(y.z*fCos) |
z | (z.x*fCos)-(y.x*fSin) | (z.y*fCos)-(y.y*fSin) | (z.z*fCos)-(y.z*fSin) |
fPitch | Angle in radians to pitch the matrix |
void BURGER_API Burger::Matrix3D_t::Roll | ( | float | fRoll | ) |
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 | |
---|---|---|---|
x | (y.x*fSin)+(x.x*fCos) | (y.y*fSin)+(x.y*fCos) | (y.z*fSin)+(x.z*fCos) |
y | (y.x*fCos)-(x.x*fSin) | (y.y*fCos)-(x.y*fSin) | (y.z*fCos)-(x.z*fSin) |
z | z.x | z.y | z.z |
fRoll | Angle in radians to roll the matrix |
void BURGER_API Burger::Matrix3D_t::Set | ( | const FixedMatrix3D_t * | pInput | ) |
Convert a fixed point matrix into a floating point matrix.
Using fixed_to_float(float *,Fixed32), convert all of the entries from a 3x3 16.16 fixed point matrix into a floating point matrix
pInput | Pointer to a valid FixedMatrix3D_t for conversion |
void BURGER_API Burger::Matrix3D_t::Set | ( | const Matrix3D_t * | pInput | ) |
Copy the matrix.
Copy a matrix into this one
pInput | Pointer to a valid Matrix3D_t for copying |
void BURGER_API Burger::Matrix3D_t::Set | ( | const Matrix4D_t * | pInput | ) |
Copy a Matrix4D_t to a Matrix3D_t.
Copy a 4x4 matrix into this one by truncating all of the w components
x | y | z | |
---|---|---|---|
x | pInput->x.x | pInput->x.y | pInput->x.z |
y | pInput->y.x | pInput->y.y | pInput->y.z |
z | pInput->z.x | pInput->z.y | pInput->z.z |
pInput | Pointer to a valid Matrix4D_t for copying |
void BURGER_API Burger::Matrix3D_t::SetFromQuaternion | ( | const Vector4D_t * | pInput | ) |
Convert a quaternion to a 3x3 matrix.
Here's the resulting matrix of math used using terms from the input quaternion
x | y | z | |
---|---|---|---|
x | 1-(2yy+2zz) | 2xy+2wz | 2xz-2wy |
y | 2xy-2wz | 1-(2xx+2zz) | 2yz+2wx |
z | 2xz+2wy | 2yz-2wx | 1-(2xx+2yy) |
pInput | Pointer to a normalized quaternion |
void BURGER_API Burger::Matrix3D_t::SetPitch | ( | float | fPitch | ) |
Initialize a rotation matrix with radians for pitch (X)
x | y | z | |
---|---|---|---|
x | 1 | 0 | 0 |
y | 0 | cx | -sx |
z | 0 | sx | cx |
fPitch | Pitch of the X in radians |
void BURGER_API Burger::Matrix3D_t::SetRoll | ( | float | fRoll | ) |
Initialize a rotation matrix with radians for roll (Z)
x | y | z | |
---|---|---|---|
x | cz | -sz | 0 |
y | sz | cz | 0 |
z | 0 | 0 | 1 |
fRoll | Roll of the Z in radians |
|
noexcept |
Create a 3D scale matrix.
Sets the x.x, y.y and z.z components to the input values and all others are set to 0.0f
x | y | z | |
---|---|---|---|
x | fX | 0 | 0 |
y | 0 | fY | 0 |
z | 0 | 0 | fZ |
fX | new x.x component |
fY | new y.y component |
fZ | new z.z component |
void BURGER_API Burger::Matrix3D_t::SetTranslate | ( | float | fX, |
float | fY ) |
Create a 2D Translation matrix.
Create an identity matrix and set the z.x and z.y terms to the input to create a translation matrix for 2d points
x | y | z | |
---|---|---|---|
x | 1 | 0 | 0 |
y | 0 | 1 | 0 |
z | fX | fY | 1 |
fX | New z.x term |
fY | New z.y term |
|
inline |
Set the X column of a matrix.
Overwrite the X column of the matrix with the input vector
x | y | z | |
---|---|---|---|
x | pInput->x | x.y | x.z |
y | pInput->y | y.y | y.z |
z | pInput->z | z.y | z.z |
pInput | Pointer to a Vector3D_t structure that has the new X column |
|
inline |
Set the X column of a matrix.
Overwrite the X column of the matrix with the input values
x | y | z | |
---|---|---|---|
x | fX | x.y | x.z |
y | fY | y.y | y.z |
z | fZ | z.y | z.z |
fX | New x.x value |
fY | New y.x value |
fZ | New z.x value |
|
inline |
Set the X row of a matrix.
Overwrite the X row of the matrix with the input vector
x | y | z | |
---|---|---|---|
x | pInput->x | pInput->y | pInput->z |
y | y.x | y.y | y.z |
z | z.x | z.y | z.z |
pInput | Pointer to a Vector3D_t structure that has the new X row |
|
inline |
Set the X row of a matrix.
Overwrite the X row of the matrix with the input values
x | y | z | |
---|---|---|---|
x | fX | fY | fZ |
y | y.x | y.y | y.z |
z | z.x | z.y | z.z |
fX | New x.x value |
fY | New x.y value |
fZ | New x.z value |
void BURGER_API Burger::Matrix3D_t::SetXYZ | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | cy*cz | (-sy*sx*cz)+(cx*-sz) | (-sy*cx*cz)+(-sx*-sz) |
y | cy*sz | (cx*cz)+(-sy*sx*sz) | (-sx*cx)+(cy*sx*-sz) |
z | sy | cy*sx | cy*cx |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::SetXZY | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | cy*cz | (cx*-sz*cy)+(-sy*sx) | (-sx*-sz*cy)+(-sy*cx) |
y | sz | cx*cz | -sx*cz |
z | sy*cz | (sx*cy)+(sy*cx*-sz) | (cx*cy)+(sy*-sx*-sz) |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::SetYaw | ( | float | fYaw | ) |
Initialize a rotation matrix with radians for yaw (Y)
x | y | z | |
---|---|---|---|
x | cy | 0 | -sy |
y | 0 | 1 | 0 |
z | sy | 0 | cy |
fYaw | Yaw of the Y in radians |
|
inline |
Set the Y column of a matrix.
Overwrite the Y column of the matrix with the input vector
x | y | z | |
---|---|---|---|
x | x.x | pInput->x | x.z |
y | y.x | pInput->y | y.z |
z | z.x | pInput->z | z.z |
pInput | Pointer to a Vector3D_t structure that has the new Y column |
|
inline |
Set the Y column of a matrix.
Overwrite the Y column of the matrix with the input values
x | y | z | |
---|---|---|---|
x | x.x | fX | x.z |
y | y.x | fY | y.z |
z | z.x | fZ | z.z |
fX | New x.y value |
fY | New y.y value |
fZ | New z.y value |
|
inline |
Set the Y row of a matrix.
Overwrite the Y row of the matrix with the input vector
x | y | z | |
---|---|---|---|
x | x.x | x.y | x.z |
y | pInput->x | pInput->y | pInput->z |
z | z.x | z.y | z.z |
pInput | Pointer to a Vector3D_t structure that has the new Y row |
|
inline |
Set the Y row of a matrix.
Overwrite the Y row of the matrix with the input values
x | y | z | |
---|---|---|---|
x | x.x | x.y | x.z |
y | fX | fY | fZ |
z | z.x | z.y | z.z |
fX | New y.x value |
fY | New y.y value |
fZ | New y.z value |
void BURGER_API Burger::Matrix3D_t::SetYXZ | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | (cy*cz)+(sy*-sx*-sz) | cx*-sz | (-sy*cz)+(cy*-sx*-sz) |
y | (sy*-sx*cz)+(cy*sz) | cx*cz | (cy*-sx*cz)+(-sy*sz) |
z | sy*cx | sx | cy*cx |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::SetYZX | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | cy*cz | -sz | -sy*cz |
y | (cy*sz*cx)+(sy*-sx) | cx*cz | (-sy*sz*cx)+(cy*-sx) |
z | (sy*cx)+(cy*sx*sz) | sx*cz | (cy*cx)+(-sy*sx*sz) |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
|
inline |
Set the Z column of a matrix.
Overwrite the Z column of the matrix with the input vector
x | y | z | |
---|---|---|---|
x | x.x | x.y | pInput->x |
y | y.x | y.y | pInput->y |
z | z.x | z.y | pInput->z |
pInput | Pointer to a Vector3D_t structure that has the new Z column |
|
inline |
Set the Z column of a matrix.
Overwrite the Z column of the matrix with the input values
x | y | z | |
---|---|---|---|
x | x.x | x.y | fX |
y | y.x | y.y | fY |
z | z.x | z.y | fZ |
fX | New x.z value |
fY | New y.z value |
fZ | New z.z value |
|
inline |
Set the Z row of a matrix.
Overwrite the Z row of the matrix with the input vector
x | y | z | |
---|---|---|---|
x | x.x | x.y | x.z |
y | y.x | y.y | y.z |
z | pInput->x | pInput->y | pInput->z |
pInput | Pointer to a Vector3D_t structure that has the new Z row |
|
inline |
Set the Z row of a matrix.
Overwrite the Z row of the matrix with the input values
x | y | z | |
---|---|---|---|
x | x.x | x.y | x.z |
y | y.x | y.y | y.z |
z | fX | fY | fZ |
fX | New z.x value |
fY | New z.y value |
fZ | New z.z value |
void BURGER_API Burger::Matrix3D_t::SetZXY | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | (cz*cy)+(-sy*sx*sz) | (-sz*cy)+(-sy*sx*cz) | -sy*cx |
y | cx*sz | cx*cz | -sx |
z | (sx*sz*cy)+(sy*cz) | (sx*cz*cy)+(sy*-sz) | cy*cx |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::SetZYX | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | cy*cz | cy*-sz | -sy |
y | (sz*cx)+(sy*-sx*cz) | (cz*cx)+(sy*-sx*-sz) | cy*-sx |
z | (sy*cz*cx)+(sx*sz) | (sy*-sz*cx)+(sx*cz) | cy*cx |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::Transform | ( | Vector3D_t * | pInput | ) | const |
Multiply a vector by a matrix.
Transform the point by the matrix
x | (xx*x)+(xy*y)+(xz*z) |
---|---|
y | (yx*x)+(yy*y)+(yz*z) |
z | (zx*x)+(zy*y)+(zz*z) |
pInput | Pointer to a Vector3D_t to transform against this matrix |
void BURGER_API Burger::Matrix3D_t::Transform | ( | Vector3D_t * | pOutput, |
const Vector3D_t * | pInput ) const |
Multiply a vector by a matrix.
Transform the point by the matrix and store the result in an uninitialized Vector3D_t
x | (xx*x)+(xy*y)+(xz*z) |
---|---|
y | (yx*x)+(yy*y)+(yz*z) |
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 |
void BURGER_API Burger::Matrix3D_t::TransformAdd | ( | Vector3D_t * | pInput, |
const Vector3D_t * | pTranslate ) const |
Transform a vector and then add a point.
Transform the point by the matrix and then add a translation vector
x | (xx*x)+(xy*y)+(xz*z)+tx |
---|---|
y | (yx*x)+(yy*y)+(yz*z)+ty |
z | (zx*x)+(zy*y)+(zz*z)+tz |
pInput | Pointer to a Vector3D_t to transform against this matrix |
pTranslate | Pointer to a Vector3D_t to add against the translated input |
void BURGER_API Burger::Matrix3D_t::TransformAdd | ( | Vector3D_t * | pOutput, |
const Vector3D_t * | pInput, | ||
const Vector3D_t * | pTranslate ) const |
Transform a vector and then add a point.
Transform the point by the matrix and store the result in an uninitialized Vector3D_t
x | (xx*x)+(xy*y)+(xz*z)+tx |
---|---|
y | (yx*x)+(yy*y)+(yz*z)+ty |
z | (zx*x)+(zy*y)+(zz*z)+tz |
pInput | Pointer to a Vector3D_t to transform against this matrix |
pOutput | Pointer to an uninitialized Vector3D_t to store the result |
pTranslate | Pointer to a Vector3D_t to add against the translated input |
void BURGER_API Burger::Matrix3D_t::Transpose | ( | const Matrix3D_t * | pInput | ) |
Perform a matrix transposition.
Swap the entries x.y and y.x, x.z and z.x, y,z and z.y 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 | |
---|---|---|---|
x | xx | yx | zx |
y | xy | yy | zy |
z | xz | yz | zz |
void BURGER_API Burger::Matrix3D_t::Transpose | ( | void | ) |
Perform a matrix transposition.
Swap the entries x.y and y.x, x.z and z.x, y,z and z.y 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 | |
---|---|---|---|
x | xx | yx | zx |
y | xy | yy | zy |
z | xz | yz | zz |
|
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 transposed matrix multiply quickly that would yield a multiplication vs a scale matrix and store the result in this Matrix3D_t
Use this formula to create the final matrix
x | y | z | |
---|---|---|---|
x | (pInput->x.x*fScaleX) | (pInput->x.y*fScaleY) | (pInput->x.z*fScaleZ) |
y | (pInput->y.x*fScaleX) | (pInput->y.y*fScaleY) | (pInput->y.z*fScaleZ) |
z | (pInput->z.x*fScaleX) | (pInput->z.y*fScaleY) | (pInput->z.z*fScaleZ) |
pInput | Pointer to a valid Matrix3D_t to apply the scale to |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z scale value |
void BURGER_API Burger::Matrix3D_t::TransposeMultiply | ( | float | fScaleX, |
float | fScaleY, | ||
float | fScaleZ ) |
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 transposed matrix multiply quickly that would yield a multiplication vs a scale matrix
Use this formula to create the final matrix
x | y | z | |
---|---|---|---|
x | (x.x*fScaleX) | (x.y*fScaleY) | (x.z*fScaleZ) |
y | (y.x*fScaleX) | (y.y*fScaleY) | (y.z*fScaleZ) |
z | (z.x*fScaleX) | (z.y*fScaleY) | (z.z*fScaleZ) |
fScaleX | X scale value |
fScaleY | Y scale value |
fScaleZ | Z scale value |
void BURGER_API Burger::Matrix3D_t::TransposeSetFromQuaternion | ( | const Vector4D_t * | pInput | ) |
Convert a quaternion to a transposed 3x3 matrix.
Here's the resulting matrix of math used using terms from the input quaternion
x | y | z | |
---|---|---|---|
x | 1-(2yy+2zz) | 2xy-2wz | 2xz+2wy |
y | 2xy+2wz | 1-(2xx+2zz) | 2yz-2wx |
z | 2xz-2wy | 2yz+2wx | 1-(2xx+2yy) |
pInput | Pointer to a normalized quaternion |
void BURGER_API Burger::Matrix3D_t::TransposeSetPitch | ( | float | fPitch | ) |
Initialize a rotation matrix with radians for pitch (X)
x | y | z | |
---|---|---|---|
x | 1 | 0 | 0 |
y | 0 | cx | sx |
z | 0 | -sx | cx |
fPitch | Pitch of the X in radians |
void BURGER_API Burger::Matrix3D_t::TransposeSetRoll | ( | float | fRoll | ) |
Initialize a rotation matrix with radians for roll (Z)
x | y | z | |
---|---|---|---|
x | cz | sz | 0 |
y | -sz | cz | 0 |
z | 0 | 0 | 1 |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::TransposeSetXYZ | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | cy*cz | (sy*-sx*cz)+(cx*sz) | (sy*cx*cz)+(sx*sz) |
y | cy*-sz | (cx*cz)+(sy*-sx*-sz) | (sx*cz)+(sy*cx*-sz) |
z | -sy | cy*-sx | cy*cx |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::TransposeSetXZY | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | cy*cz | (cx*sz*cy)+(sy*-sx) | (sx*sz*cy)+(sy*cx) |
y | -sz | cx*cz | sx*cz |
z | -sy*cz | (-sx*cy)+(-sy*cx*sz) | (cx*cy)+(-sy*sx*sz) |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::TransposeSetYaw | ( | float | fYaw | ) |
Initialize a rotation matrix with radians for yaw (Y)
x | y | z | |
---|---|---|---|
x | cy | 0 | sy |
y | 0 | 1 | 0 |
z | -sy | 0 | cy |
fYaw | Yaw of the Y in radians |
void BURGER_API Burger::Matrix3D_t::TransposeSetYXZ | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | (cy*cz)+(-sy*sx*sz) | cx*sz | (sy*cz)+(cy*sx*sz) |
y | (-sy*sx*cz)+(cy*-sz) | cx*cz | (cy*sx*cz)+(sy*-sz) |
z | -sy*cx | -sx | cy*cx |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::TransposeSetYZX | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | cy*cz | sz | sy*cz |
y | (cy*-sz*cx)+(-sy*sx) | cx*cz | (sy*-sz*cx)+(cy*sx) |
z | (-sy*cx)+(cy*-sx*-sz) | -sx*cz | (cy*cx)+(sy*-sx*-sz) |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::TransposeSetZXY | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | (cz*cy)+(sy*-sx*-sz) | (sz*cy)+(sy*-sx*cz) | sy*cx |
y | cx*-sz | cx*cz | sx |
z | (-sx*-sz*cy)+(-sy*cz) | (-sx*cz*cy)+(-sy*sz) | cy*cx |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::TransposeSetZYX | ( | float | fYaw, |
float | fPitch, | ||
float | fRoll ) |
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 | |
---|---|---|---|
x | cy*cz | cy*sz | sy |
y | (-sz*cx)+(-sy*sx*cz) | (cz*cx)+(-sy*sx*sz) | cy*sx |
z | (-sy*cz*cx)+(-sx*-sz) | (-sy*sz*cx)+(-sx*cz) | cy*cx |
fYaw | Yaw of the Y in radians |
fPitch | Pitch of the X in radians |
fRoll | Roll of the Z in radians |
void BURGER_API Burger::Matrix3D_t::TransposeTransform | ( | Vector3D_t * | pInput | ) | const |
Multiply a vector by a transposed matrix.
Transform the point by the transposed matrix
x | (xx*x)+(yx*y)+(zx*z) |
---|---|
y | (xy*x)+(yy*y)+(zy*z) |
z | (xz*x)+(yz*y)+(zz*z) |
pInput | Pointer to a Vector3D_t to transform against this transposed matrix |
void BURGER_API Burger::Matrix3D_t::TransposeTransform | ( | Vector3D_t * | pOutput, |
const Vector3D_t * | pInput ) const |
Multiply a vector by a transposed matrix.
Transform the point by the transposed matrix and store the result in an uninitialized Vector3D_t
x | (xx*x)+(yx*y)+(zx*z) |
---|---|
y | (xy*x)+(yy*y)+(zy*z) |
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 |
void BURGER_API Burger::Matrix3D_t::TransposeTransformAdd | ( | Vector3D_t * | pInput, |
const Vector3D_t * | pTranslate ) const |
Transform a vector and then add a point.
Transform the point by the transposed matrix and then add a translation vector
x | (xx*x)+(yx*y)+(zx*z)+tx |
---|---|
y | (xy*x)+(yy*y)+(zy*z)+ty |
z | (xz*x)+(yz*y)+(zz*z)+tz |
pInput | Pointer to a Vector3D_t to transform against this transposed matrix |
pTranslate | Pointer to a Vector3D_t to add against the translated input |
void BURGER_API Burger::Matrix3D_t::TransposeTransformAdd | ( | Vector3D_t * | pOutput, |
const Vector3D_t * | pInput, | ||
const Vector3D_t * | pTranslate ) const |
Transform a vector and then add a point.
Transform the point by the transposed matrix and store the result in an uninitialized Vector3D_t
x | (xx*x)+(yx*y)+(zx*z)+tx |
---|---|
y | (xy*x)+(yy*y)+(zy*z)+ty |
z | (xz*x)+(yz*y)+(zz*z)+tz |
pInput | Pointer to a Vector3D_t to transform against this transposed matrix |
pOutput | Pointer to an uninitialized Vector3D_t to store the result |
pTranslate | Pointer to a Vector3D_t to add against the translated input |
void BURGER_API Burger::Matrix3D_t::Yaw | ( | float | fYaw | ) |
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 | |
---|---|---|---|
x | (z.x*fSin)+(x.x*fCos) | (z.y*fSin)+(x.y*fCos) | (z.z*fSin)+(x.z*fCos) |
y | y.x | y.y | y.z |
z | (z.x*fCos)-(x.x*fSin) | (z.y*fCos)-(x,y*fSin) | (z.z*fCos)-(x.z*fSin) |
fYaw | Angle in radians to yaw the matrix |
void BURGER_API Burger::Matrix3D_t::Zero | ( | void | ) |
Clear out a 3D matrix.
Set all of the entries to zero
x | y | z | |
---|---|---|---|
x | 0 | 0 | 0 |
y | 0 | 0 | 0 |
z | 0 | 0 | 0 |
Vector3D_t Burger::Matrix3D_t::x |
32 bit floating point X row for the 3D Matrix
Vector3D_t Burger::Matrix3D_t::y |
32 bit floating point Y row for the 3D Matrix
Vector3D_t Burger::Matrix3D_t::z |
32 bit floating point Z row for the 3D Matrix