Math module

translate

procedure · 2 overloadsSource

Adds t to the translation column of a Matrix4 and returns the result; given a pointer it changes the matrix. The move is in the output space (after the matrix's own transform), so it equals make_translation_matrix4(t) * m.

ExampleOpen in playground ↗
m := make_scale_matrix4(xyz(2, 2, 2));
moved := translate(m, xyz(5, 0, 0));
assert(transform_point(moved, xyz(1, 1, 1)) == xyz(7, 2, 2));
translate :: (m: Matrix4, t: Vector3) -> Matrix4

m with t added to its translation.

Parameters

m: Matrix4
the matrix.
t: Vector3
the offset on x, y and z.

Returns

translate :: (m: *Matrix4, t: Vector3)

Adds t to the translation of the matrix, in place.

Parameters

m: *Matrix4
the matrix to change.
t: Vector3
the offset on x, y and z.

See also