Game Development Reference
In-Depth Information
is made by swapping its rows and columns:
adg
beh
cf i
M =
If M is a rotation matrix, then
M =
M 1
We can implement this for our 3
3 matrix in this way:
Excerpt from include/cyclone/core.h
×
/**
* Holds an inertia tensor, consisting of a 3x3 row-major matrix.
* This matrix is not padding to produce an aligned structure, since
* it is most commonly used with a mass (single real) and two
* damping coefficients to make the 12-element characteristics array
* of a rigid body.
*/
class Matrix3
// ... Other Matrix3 code as before ...
/**
* Sets the matrix to be the transpose of the given matrix.
*
* @param m The matrix to transpose and use to set this.
*/
void setTranspose(const Matrix3 &m)
{
data[0] = m.data[0];
data[1] = m.data[3];
data[2] = m.data[6];
data[3] = m.data[1];
data[4] = m.data[4];
data[5] = m.data[7];
data[6] = m.data[2];
data[7] = m.data[5];
data[8] = m.data[8];
}
/** Returns a new matrix containing the transpose of this matrix. */
Matrix3 transpose() const
{
Matrix3 result;
Search Nedrilad ::




Custom Search