Back to class index

Class float3x3

Summary

A 3-by-3 matrix for linear transformations of 3D geometry.

Description

This matrix can represent any kind of linear transformations of 3D geometry, which include rotation, scale, shear, mirroring and orthographic projection. A 3x3 matrix cannot represent translation (which requires a 3x4 matrix), or perspective projection (which requires a 4x4 matrix).

The elements of this matrix are m_00, m_01, m_02 m_10, m_11, m_12 m_20, m_21, m_22

The element m_yx is the value on the row y and column x. You can access m_yx using the double-bracket notation m[y][x], or using the member function m.At(y, x);

The member functions in this class use the convention that transforms are applied to vectors in the form M * v. This means that "float3x3 M, M1, M2; M = M1 * M2;" gives a transformation M that applies M2 first, followed by M1 second, i.e. M * v = M1 * M2 * v = M1 * (M2 * v). This is the convention commonly used with OpenGL. The opposing convention (v * M) is commonly used with Direct3D.

This class uses row-major storage, which means that the elements are packed in memory in order m[0][0], m[0][1], m[0][2], m[0][3], m[1][0], m[1][1], ... The elements for a single row of the matrix hold successive memory addresses. This is the same memory layout as with C++ multidimensional arrays.

Contrast this with column-major storage, in which the elements are packed in the memory in order m[0][0], m[1][0], m[2][0], m[3][0], m[0][1], m[1][1], ... There the elements for a single column of the matrix hold successive memory addresses. This is exactly opposite from the standard C++ multidimensional arrays, since if you have e.g. int v[10][10], then v[0][9] comes in memory right before v[1][0]. ( [0][0], [0][1], [0][2], ... [1][0], [1][1], ...)

Member Reference

float3x3A 3-by-3 matrix for linear transformations of 3D geometry.
vStores the data in this matrix in row-major format. [noscript].
zero[static][const]A constant matrix that has zeroes in all its entries.
identity[static][const]A constant matrix that is the identity.
nan[static][const]A compile-time constant float3x3 which has NaN in each element.
ctor (+3 overloads)Creates a new float3x3 with uninitialized member values.
ToQuat()[const]Converts this rotation matrix to a quaternion.
GetScale()[const]Returns the scaling performed by this matrix.
operator[](row) (+1 overload)Computes the covariance matrix of the given set of data points.
At(row,col) (+1 overload)Returns the given element. [noscript].
Row(row) (+1 overload)Returns the given row. [noscript].
Row3(row) (+1 overload)
Col(col)[const]Returns the given column.
Col3(col)[const]
Diagonal()[const]Returns the main diagonal.
ScaleRow(row,scalar)Scales the given row by a scalar.
ScaleCol(col,scalar)Scales the given column by a scalar.
PositiveX/Y/Z()[const]Returns the local +X/+Y/+Z axis in world space.
ptr() (+1 overload)Accesses this structure as a float array.
SetRow(row,data) (+2 overloads)Sets the values of the given row.
SetCol(column,data) (+2 overloads)Sets the values of the given column.
Set(...) (+3 overloads)Sets all values of this matrix.
SetIdentity()Sets this matrix to equal the identity.
SwapColumns(col1,col2)Swaps two columns.
SwapRows(row1,row2)Swaps two rows.
SetRotatePart/X/Y/Z(...) (+1 overload)Sets this matrix to perform rotation about the given axis and angle.
operator=(rhs) (+1 overload)
Determinant()[const]Computes the determinant of this matrix.
DeterminantSymmetric()[const]Computes the determinant of a symmetric matrix.
Inverse(epsilon)Returns the adjugate of this matrix.
InverseFast(epsilon)Inverts this matrix using Cramer's rule.
SolveAxb(b,x)[const]Solves the linear equation Ax=b.
Inverted()[const]Returns an inverted copy of this matrix.
InverseColOrthogonal()Inverts a column-orthogonal matrix.
InverseOrthogonalUniformScale()Inverts a matrix that is a concatenation of only rotate and uniform scale operations.
InverseOrthonormal()Inverts a rotation matrix.
InverseSymmetric()Inverts a symmetric matrix.
Transpose()Transposes this matrix.
Transposed()[const]Returns a transposed copy of this matrix.
InverseTranspose()Computes the inverse transpose of this matrix in-place.
InverseTransposed()[const]Returns the inverse transpose of this matrix.
Trace()[const]Returns the sum of the diagonal elements of this matrix.
Orthonormalize(...)Orthonormalizes the basis formed by the column vectors of this matrix.
RemoveScale()Removes the scaling performed by this matrix.
Transform(vector)[const] (+1 overload)Transforms the given 3-vector by this matrix M, i.e. returns M * (x, y, z).
TransformLeft(lhs)[const]Transforms the given 3-vector by this matrix M so that the vector occurs on the left-hand side, i.e.
Transform(vector)[const]Transforms the given 4-vector by this matrix M, i.e.
BatchTransform(...)[const] (+3 overloads)Performs a batch transform of the given array.
operator*(rhs)[const] (+4 overloads)Multiplies the two matrices.
operator/(scalar)[const]
operator+(rhs)[const]
operator-(rhs)[const] (+1 overload)
operator+()[const]Unary operator + allows this structure to be used in an expression '+x'.
operator*=(scalar)
operator/=(scalar)
operator+=(rhs)
operator-=(rhs)
IsFinite()[const]Tests if this matrix does not contain any NaNs or infs.
IsIdentity(epsilon)[const]Tests if this is the identity matrix.
IsLowerTriangular(epsilon)[const]Tests if this matrix is in lower triangular form.
IsUpperTriangular(epsilon)[const]Tests if this matrix is in upper triangular form.
IsInvertible(epsilon)[const]Tests if this matrix has an inverse.
IsSymmetric(epsilon)[const]Tests if this matrix is symmetric (M == M^T).
IsSkewSymmetric(epsilon)[const]Tests if this matrix is skew-symmetric (M == -M^T).
HasUnitaryScale(epsilonSq)[const]Returns true if this matrix does not perform any scaling.
HasNegativeScale()[const]Returns true if this matrix performs a reflection along some plane.
HasUniformScale(epsilon)[const]Returns true if this matrix contains only uniform scaling, compared to the given epsilon.
IsRowOrthogonal(epsilon)[const]Returns true if the row vectors of this matrix are all perpendicular to each other.
IsColOrthogonal(epsilon)[const]Returns true if the column vectors of this matrix are all perpendicular to each other.
IsColOrthogonal3(epsilon)[const]
IsOrthonormal(epsilon)[const]Returns true if the column and row vectors of this matrix form an orthonormal set.
Equals(other,epsilon)[const]Returns true if this float3x3 is equal to the given float3x3, up to given per-element epsilon.
ToString()[const]Returns "(m00, m01, m02; m10, m11, m12; m20, m21, m22)".
SerializeToString()[const]
ToString2()[const]
ToEuler***()[const]Extracts the rotation part of this matrix into Euler rotation angles (in radians).
ExtractScale()[const]Returns the scale components of this matrix.
Decompose(rotate,scale)[const] (+1 overload)Decomposes this matrix to rotate and scale parts.
Mul(rhs)[const] (+5 overloads)
MulPos(rhs)[const] (+1 overload)
MulDir(rhs)[const] (+1 overload)
RotateX/Y/Z(angleRadians)[static]Creates a new float3x3 that rotates about one of the principal axes by the given angle.
RotateAxisAngle(...)[static]Creates a new float3x3 that rotates about the given axis by the given angle.
RotateFromTo(...)[static]Creates a matrix that rotates the sourceDirection vector to coincide with the targetDirection vector.
LookAt(...)[static]Creates a LookAt matrix.
RandomRotation(lcg)[static]Returns a uniformly random 3x3 matrix that performs only rotation.
RandomGeneral(...)[static]Returns a random 3x3 matrix with each entry randomized between the range[minElem, maxElem].
FromQuat(orientation)[static]Creates a new float3x3 that performs the rotation expressed by the given quaternion.
FromRS(rotate,scale)[static] (+1 overload)Creates a new float3x3 as a combination of rotation and scale.
FromEuler***(ex,ey,ex2)[static]Creates a new float3x3 from the given sequence of Euler rotation angles (in radians).
Scale(sx,sy,sz)[static] (+1 overload)Creates a new transformation matrix that scales by the given factors.
ScaleAlongAxis(axis,scalingFactor)[static]Creates a new float3x3 that scales points along the given axis.
UniformScale(uniformScale)[static]Creates a new float3x3 that performs uniform scaling by the given amount.
ShearX/Y/Z(yFactor,zFactor)[static]Produces a matrix that shears along a principal axis.
Mirror(p)[static]Creates a new matrix that mirrors with respect to the given plane.
OrthographicProjection/YZ/XZ/XY(target)[static]Creates a new float3x3 that performs orthographic projection.
Back to class index