Back to class index

Class float3x4

Summary

A 3-by-4 matrix for affine transformations of 3D geometry.

Description

This matrix type can represent affine operations in addition to linear ones. Affine operations translate the geometry with respect to the origin point, whereas linear transformations retain the origin of the coordinate system in place.

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

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 "float3x4 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

float3x4A 3-by-4 matrix for affine transformations of 3D geometry.
vStores the data in this matrix in row-major format.
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 float3x4 which has NaN in each element.
ctor (+6 overloads)Creates a new float3x4 with uninitialized member values.
GetScale()[const]Returns the scaling performed by this matrix.
operator[](row) (+1 overload)Returns the given element. [noscript].
At(row,col) (+1 overload)Returns the given element. [noscript].
Row(row) (+1 overload)Returns the given row. [noscript].
Row3(row) (+1 overload)Returns the three first elements of the given row. [noscript].
Col(col)[const]Returns the given column.
Col3(col)[const]
Diagonal()[const]Returns the main diagonal.
ScaleRow3(row,scalar)Scales the three first elements of the given row by a scalar.
ScaleRow(row,scalar)Scales the given row by a scalar.
ScaleCol(col,scalar)Scales the given column by a scalar.
Float3x3Part()[const]Returns the upper-left 3-by-3 part.
TranslatePart()[const]Returns the translation part.
RotatePart()[const]Returns the upper-left 3x3 part of this matrix. This part stores the rotation of this transform.
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) (+3 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.
Set3x3Part(rotation)
SetIdentity()Sets this matrix to equal the identity.
SwapColumns(col1,col2)Swaps two columns.
SwapRows(row1,row2)Swaps two rows.
SetTranslatePart(tx,ty,tz) (+1 overload)Sets the translation part of this matrix.
SetRotatePart/X/Y/Z(...) (+2 overloads)Sets the 3-by-3 part of this matrix to perform rotation about the given axis and angle.
operator=(rhs) (+2 overloads)Sets this float3x4 to represent the same transformation as the given float3x3.
Determinant()[const]Computes the determinant of this matrix.
Inverse(epsilon)Inverts this matrix using the generic Gauss's method.
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 translate, rotate and uniform scale operations.
InverseOrthonormal()Inverts a matrix that is a concatenation of only translate and rotate operations.
Transpose3()Transposes the top-left 3x3 part of this matrix in-place.
Transposed3()[const]Returns a copy of this matrix which has the top-left 3x3 part transposed.
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.
TransformPos(pointVector)[const] (+1 overload)Transforms the given point vector by this matrix M , i.e. returns M * (x, y, z, 1).
TransformDir(directionVector)[const] (+2 overloads)Transforms the given direction vector by this matrix M , i.e. returns M * (x, y, z, 0).
Transform(vector)[const]Transforms the given 4-vector by this matrix M, i.e. returns M * (x, y, z, w).
BatchTransformPos(...)[const] (+3 overloads)Performs a batch transform of the given array of point vectors.
BatchTransformDir(...)[const] (+3 overloads)Performs a batch transform of the given array of direction vectors.
BatchTransform(...)[const] (+1 overload)Performs a batch transform of the given array.
operator*(rhs)[const] (+4 overloads)Treats the float3x3 as a 4-by-4 matrix with the last row and column as identity, and 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 3x3 top-left submatrix are all perpendicular to each other.
IsColOrthogonal(epsilon)[const]Returns true if the column vectors of 3x3 top-left submatrix are all perpendicular to each other.
IsColOrthogonal3(epsilon)[const]
IsOrthonormal(epsilon)[const]Returns true if the column and row vectors of the 3x3 top-left submatrix form an orthonormal set.
Equals(other,epsilon)[const]Returns true if this float3x4 is equal to the given float3x4, up to given per-element epsilon.
ToString()[const]Returns a string representation of form "(m00, m01, m02, m03; m10, m11, m12, m13; ... )".
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(...)[const] (+2 overloads)Decomposes this matrix to translate, rotate and scale parts.
Mul(rhs)[const] (+3 overloads)
MulPos(pointVector)[const] (+1 overload)
MulDir(directionVector)[const] (+1 overload)
Mul(vector)[const]
Translate(tx,ty,tz)[static] (+2 overloads)Creates a new transformation matrix that translates by the given offset.
RotateX/Y/Z(...)[static] (+1 overload)Creates a new float3x4 that rotates about one of the principal axes.
RotateAxisAngle(...)[static] (+1 overload)Creates a new float3x4 that rotates about the given axis.
RotateFromTo(...)[static] (+1 overload)Creates a new float3x4 that rotates sourceDirection vector to coincide with the targetDirection vector.
RandomGeneral(...)[static]Returns a random 3x4 matrix with each entry randomized between the range[minElem, maxElem].
RandomRotation(lcg)[static]Returns a uniformly random 3x4 matrix that performs only rotation.
FromQuat(orientation)[static] (+1 overload)Creates a new float3x4 that rotates one coordinate system to coincide with another.
FromTRS(...)[static] (+2 overloads)Creates a new float3x4 as a combination of translation, rotation and scale.
FromEuler***(ex,ey,ex2)[static]Creates a new float3x4 from the given sequence of Euler rotation angles (in radians).
Scale(sx,sy,sz)[static] (+4 overloads)Creates a new transformation matrix that scales by the given factors.
ScaleAlongAxis(...)[static] (+1 overload)Creates a new float3x4 that scales points along the given axis.
UniformScale(uniformScale)[static] (+1 overload)Creates a new float3x4 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 float3x4 that performs orthographic projection.
LookAt(...)[static] (+1 overload)Creates a LookAt matrix from a look-at direction vector.
Back to class index