angle

m3sh.linalg.angle(v, w, a=None, deg=False)[source]

Angle between vectors.

Angle between vectors \(\mathbf{v}\) and \(\mathbf{w}\) in radians. To obtain an oriented angle an axis vector \(\mathbf{a}\) has to be specified. Typically the axis vector is a vector parallel to the cross product vector \(\mathbf{v} \times \mathbf{w}\) with the desired orientation.

Parameters:
  • v (ndarray, shape (3, )) – Vector in 3-space.

  • w (ndarray, shape (3, )) – Vector in 3-space.

  • a (ndarray, shape (3, ), optional) – Axis vector in 3-space.

  • deg (bool, optional) – Convert result from radians to degrees.

Returns:

Angle in degrees or radians.

Return type:

float

Note

If an axis vector is defined the sign is determined via the right-hand rule. None of the vectors may be the zero vector. The axis vector may not be contained in the span of \(\mathbf{v}\) and \(\mathbf{w}\).