# psychopy.tools.mathtools.translationMatrix¶

psychopy.tools.mathtools.translationMatrix(t, out=None, dtype=None)[source]

Create a translation matrix.

The resulting matrix is the same as generated by a glTranslate call.

Parameters
• t (ndarray, tuple, or list of float) – Translation vector [tx, ty, tz].

• out (ndarray, optional) – Optional output array. Must be same shape and dtype as the expected output if out was not specified.

• dtype (dtype or str, optional) – Data type for computations can either be ‘float32’ or ‘float64’. If out is specified, the data type of out is used and this argument is ignored. If out is not provided, ‘float64’ is used by default.

Returns

4x4 translation matrix in row-major order. Will be the same array as out if specified, if not, a new array will be allocated.

Return type

ndarray