psychopy.tools.mathtools.scaleMatrix

psychopy.tools.mathtools.scaleMatrix(s, out=None, dtype=None)[source]

Create a scaling matrix.

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

Parameters:
  • s (array_like, float or int) – Scaling factor(s). If s is scalar (float), scaling will be uniform. Providing a vector of scaling values [sx, sy, sz] will result in an anisotropic scaling matrix if any of the values differ.

  • 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 scaling matrix in row-major order.

Return type:

ndarray


Back to top