Math module

make_matrix_from_rows

procedure · 1 overloadSource

A matrix whose first three rows are the vectors xprime, yprime, zprime (the rest as in the identity). The type defaults to Matrix4; pass Matrix3 as the last argument for that. Multiplying a point by it takes the point's components along those three directions.

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

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

Parameters

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

Returns

T

See also