scipp.spatial.angle_between#

scipp.spatial.angle_between(a, b)#

Compute the angle between two vectors.

The computed angle is in the range \([0, \pi]\). It is equivalent to \(\alpha\) in

\[2\theta &= \mathsf{acos}(\frac{a \cdot b}{|a| |b|})\]

But this function uses a numerically more stable implementation by W. Kahan described in paragraph 13 of

“Cross-Products and Rotations in 2- and 3-Dimensional Euclidean Spaces: Notes for Math. H110” W. Kahan, 2000, https://people.eecs.berkeley.edu/~wkahan/MathH110/Cross.pdf

Parameters:
Returns:

Variable | DataArray | Dataset | DataGroup[Any] – The angle between a and b in radians.