# psychopy.tools.mathtools.posOriToMatrix¶

psychopy.tools.mathtools.posOriToMatrix(pos, ori, out=None, dtype=None)[source]

Convert a rigid body pose to a 4x4 transformation matrix.

A pose is represented by a position coordinate pos and orientation quaternion ori.

Parameters
• pos (ndarray, tuple, or list of float) – Position vector [x, y, z].

• ori (tuple, list or ndarray of float) – Orientation quaternion in form [x, y, z, w] where w is real and x, y, z are imaginary components.

• 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 transformation matrix.

Return type

ndarray