Compute the ang between two quaternions w/3-element representations.
(x, y=None)
| 1410 | |
| 1411 | |
| 1412 | def _angle_between_quats(x, y=None): |
| 1413 | """Compute the ang between two quaternions w/3-element representations.""" |
| 1414 | # z = conj(x) * y |
| 1415 | # conjugate just negates all but the first element in a 4-element quat, |
| 1416 | # so it's just a negative for us |
| 1417 | y = np.zeros(3) if y is None else y |
| 1418 | z = _quat_mult(-x, y) |
| 1419 | z0 = _quat_real(z) |
| 1420 | return 2 * np.arctan2(np.linalg.norm(z, axis=-1), z0) |
| 1421 | |
| 1422 | |
| 1423 | def _quat_real(quat): |