psychopy.tools.mathtools.reflect

psychopy.tools.mathtools.reflect(v, n, out=None, dtype=None)[source]

Reflection of a vector.

Get the reflection of v relative to normal n.

Parameters:
  • v (array_like) – Vector to reflect, can be Nx2, Nx3, or Nx4. If a 2D array is specified, rows are treated as separate vectors.

  • n (array_like) – Normal vector, must have same shape as v.

  • 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:

Reflected vector v off normal n.

Return type:

ndarray


Back to top