Get Involved

Float3x3

A 3x3 matrix of floating-point values.

A Float3x3 can represent any linear transformation in 3D space without a translation component, such as rotation, scale or shear. If a translation component is needed, use Float3x4 or Float4x4.

The matrix is stored in column-major order. In other words, it's an array of three Float3 column vectors.

Header File

#include <ply-math/Matrix.h>

Also included from <ply-math/Base.h>.

Constructors

  Float3x3::Float3x3() [code]

Constructs an uninitialized Float3x3.

  Float3x3::Float3x3(const Float3& col0, const Float3& col1, const Float3& col2) [code]

Constructs a 3x3 matrix from the given column vectors.

Float3x3 m = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};

Element Access

Float3& Float3x3::operator[](ureg i) [code]
const Float3& Float3x3::operator[](ureg i) const [code]

Accesses the column vector at the specified index.

Float3x3 m = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
m[0].x = -1;
StdOut::text() << m[2];  // "{0, 0, 1}"

Comparison Functions

bool operator==(const Float3x3& a, const Float3x3& b) [code]
bool operator!=(const Float3x3& a, const Float3x3& b) [code]

Returns true if the matrices are equal (or not equal) using floating-point comparison. In particular, a component with a value of 0.f is equal to a component with a value of -0.f.

Creation Functions

 static Float3x3 Float3x3::identity() [code]

Returns the identity matrix {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}.

 static Float3x3 Float3x3::makeScale(const Float3& arg) [code]

Returns a scale matrix.

 static Float3x3 Float3x3::makeRotation(const Float3& unitAxis, float radians) [code]

Returns a matrix that performs a counter-clockwise rotation around the specified axis following the right-hand rule. unitAxis must have have unit length and the angle is specified in radians.

 static Float3x3 Float3x3::fromQuaternion(const Quaternion& q) [code]

Returns a matrix that performs the same rotation as q.

Matrix Operations

 Float3x3 Float3x3::transposed() const [code]

Returns the transpose of the 3x3 matrix. If the matrix is orthogonal (in other words, it consists only of a rotation and/or reflection), this function also returns the inverse matrix.

Float3 operator*(const Float3x3& m, const Float3& v) [code]

Transform a vector using a matrix. v is treated as a column vector and premultiplied by the matrix m.

Float3x3 operator*(const Float3x3& a, const Float3x3& b) [code]

Matrix multiplication.