pytransform3d.rotations.quaternion_dist

pytransform3d.rotations.quaternion_dist(q1, q2)[source]

Compute distance between two quaternions.

We use the angular metric of S^3, which is defined as

d(q_1, q_2) = \min(|| \log(q_1 * \overline{q_2})||,
                    2 \pi - || \log(q_1 * \overline{q_2})||)

Parameters
q1array-like, shape (4,)

First quaternion

q2array-like, shape (4,)

Second quaternion

Returns
distfloat

Distance between q1 and q2

Examples using pytransform3d.rotations.quaternion_dist