Re: [eigen] Why does Eigen::Quaterniond::angularDistance() method return the absolute angle? |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: "eigen@xxxxxxxxxxxxxxxxxxx" <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] Why does Eigen::Quaterniond::angularDistance() method return the absolute angle?*From*: "Dluhosch, Michael" <michael.dluhosch@xxxxxxxxxx>*Date*: Thu, 9 Aug 2018 09:16:01 +0000*Accept-language*: en-US*Thread-index*: AQHULltCSIGa5cOXIEGKjqg2RSTbI6S1YUGAgAG7qOw=*Thread-topic*: [eigen] Why does Eigen::Quaterniond::angularDistance() method return the absolute angle?

Ok, I can see your point regarding angular distance. The issue I'm facing happens for really large angles in my application I have following 2 quaternions: q0= [0]:0.42320069127859006
and q1= [0]:-0.50596192324633082
a = q0.angularDistance(q1) returns 0.30801826469545818 ( ~17.6 deg ) q = q0.conjugate() * q1; b = 2 * std::atan2( q.vec().norm(), std::fabs(q.w()) ) returns 5.9751670424841281 (342.4 deg)
For my understanding if you wanted to ensure (-pi,pi] the angle should be -17.6 deg Maybe the atan2 when used with proper quaternions can never return negative values? So the times 2 is used to ensure [0,pi) ?
I did not find the derivation of this formula and even if probably I wouldn't understand it. But at least also here it is written without the absolute value:
Michael
From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>Sent: Wednesday, August 8, 2018 10:13 AMTo: eigenSubject: Re: [eigen] Why does Eigen::Quaterniond::angularDistance() method return the absolute angle?
One reasons is that a distance is expected to be symmetric and positive. Another one is that the "sign" is relative to the axis of rotation, so returning a "signed" angular distance alone does not seem to make much sense. Perhaps you want:
AngleAxisd aa(q1*q2.conjugate());
and if you really don't care about the axis defining the sign:
double a = AngleAxisd(q1*q2.conjugate()).angle();
gael
On Tue, Aug 7, 2018 at 4:59 PM Dluhosch, Michael <michael.dluhosch@xxxxxxxxxx> wrote:
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail. Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent over public networks. If you have any concerns over the content of this message or its Accuracy or Integrity, please contact Airbus immediately. All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you should take whatever measures you deem to be appropriate to ensure that this message and any attachments are virus free. |

**Follow-Ups**:

**References**:**[eigen] Why does Eigen::Quaterniond::angularDistance() method return the absolute angle?***From:*Dluhosch, Michael

**Re: [eigen] Why does Eigen::Quaterniond::angularDistance() method return the absolute angle?***From:*Gael Guennebaud

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Why does Eigen::Quaterniond::angularDistance() method return the absolute angle?** - Next by Date:
**Re: [eigen] Why does Eigen::Quaterniond::angularDistance() method return the absolute angle?** - Previous by thread:
**Re: [eigen] Why does Eigen::Quaterniond::angularDistance() method return the absolute angle?** - Next by thread:
**Re: [eigen] Why does Eigen::Quaterniond::angularDistance() method return the absolute angle?**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |