Math module

make_matrix_from_columns

procedure · 1 overloadSource

A matrix whose first three columns are xprime, yprime, zprime: it sends the x, y and z axes to those vectors. The type defaults to Matrix4; pass Matrix3 as the last argument for that.

ExampleOpen in playground ↗
m := make_matrix_from_columns(xyz(0, 1, 0), xyz(1, 0, 0), xyz(0, 0, 1));
assert(m * xyzw(1, 0, 0, 1) == xyzw(0, 1, 0, 1));
make_matrix_from_columns :: (
    xprime: Vector3,
    yprime: Vector3,
    zprime: Vector3,
    $T := Matrix4
) -> T

A matrix whose upper-left 3x3 has the given vectors as its columns. The rest is the identity.

Parameters

xprime: Vector3
the first column.
yprime: Vector3
the second column.
zprime: Vector3
the third column.
$T := Matrix4
the matrix type to make.

Returns

T

See also