← Back to team overview

yade-dev team mailing list archive

Re: computation of MomentBending

 



2/ Then I rediscovered that aa.angle() can return nan, as commented in
source file, it happens when the quaternion is close to identity. Please
apologise for my lack of culture, but what does represent physicaly a
quaternion close to identity?
hmm. All quaternions that we use are identity quaternions:
a^2+b^2+c^2+d^2=1. If that condition is not kept, then it is not a
rotation, but just some random quaternions.

If I'm the author of this comment in the sources (I am, probably), "close to identity" means close to null rotation. In other words the corresponding rotation matrix is very close to identity matrix. So, let M be a rotation matrix defining a rotation of 10^-8 degrees. Theoretically, M*M^(-1)=Id. Now, do the same numerically with quaternions : let q be the quaternion representing the same rotation as matrix M, and compute q*q.conjugate(). It seems, sometimes in Eigen, the result will be NaN.
As a workaround, I set angle=0 when angle=NaN.

Bruno




Follow ups

References