pytransform3d.batch_rotations.angles_between_vectors#
- pytransform3d.batch_rotations.angles_between_vectors(A, B)[source]#
Compute angle between two vectors.
\[\theta = 2 \operatorname{atan2} \left( \left\| \|b\| a - \|a\| b \right\|, \left\| \|b\| a + \|a\| b \right\| \right)\]See [1], page 47. To simplify the implementation, we normalize both vectors first such that norms of 1 cancel.
- Parameters:
- Aarray-like, shape (…, n)
nd vectors
- Barray-like, shape (…, n)
nd vectors
- Returns:
- anglesarray, shape (…)
Angles between pairs of vectors from A and B
References
[1]Kahan, W. (2006). How Futile are Mindless Assessments of Roundoff in Floating-Point Computation? https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf