Comparison between two quaternions modulo 2*pi

Submitted by Vincent Samy

Assigned to Nobody

Link to original bugzilla bug (#1713)
Version: 3.3 (current stable)

Description

Hello,

So i bumped into a problem with quaternion function isApprox that tells whether or not two quaternions are the same. Though, quaternions can represent the same rotation and have different values. Here is the code.

Eigen::Quaterniond q1 = Eigen::Quaterniond::UnitRandom();
Eigen::Quaterniond q2(-q1.w(), -q1.x(), -q1.y(), -q1.z());
q1.isApprox(q2); // return false
q1.angularDistance(q2); // return 0

q1 and q2 represent the same rotation (modulo 2*pi), maybe the function should return true?

Best,

Vincent S.

Edited by Christoph Hertzberg