psychopy.tools.mathtools.angleTo

psychopy.tools.mathtools.angleTo(v, point, degrees=True, out=None, dtype=None)[source]

Get the relative angle to a point from a vector.

The behaviour of this function depends on the format of the input arguments:

  • If v0 and v1 are 1D, the angle is returned as a scalar and out is ignored.

  • If v0 and v1 are 2D, an array of angles between corresponding row vectors are returned.

  • If either v0 and v1 are 1D and 2D, an array of angles between each row of the 2D vector and the 1D vector are returned.

Parameters
  • v (array_like) – Direction vector [x, y, z].

  • point (array_like) – Point(s) to compute angle to from vector v.

  • degrees (bool, optional) – Return the resulting angles in degrees. If False, angles will be returned in radians. Default is True.

  • 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

Distance between vectors v0 and v1.

Return type

ndarray


Back to top