psychopy.tools.mathtools.lookAt¶
- psychopy.tools.mathtools.lookAt(eyePos, centerPos, upVec=(0.0, 1.0, 0.0), out=None, dtype=None)[source]¶
Create a transformation matrix to orient a view towards some point.
Based on the same algorithm as ‘gluLookAt’. This does not generate a projection matrix, but rather the matrix to transform the observer’s view in the scene.
For more information see: https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluLookAt.xml
- Parameters:
eyePos (list of float or ndarray) – Eye position in the scene.
centerPos (list of float or ndarray) – Position of the object center in the scene.
upVec (list of float or ndarray, optional) – Vector defining the up vector. Default is +Y is up.
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 arrays, can either be ‘float32’ or ‘float64’. If None is specified, the data type is inferred by out. If out is not provided, the default is ‘float64’.
- Returns:
4x4 view matrix
- Return type:
ndarray
Notes
This function was moved from viewtools in version 2025.1.0.
The returned matrix is row-major. Values are floats with 32-bits of precision stored as a contiguous (C-order) array.