[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IMP-users] Rotations and Euler angles - possibly wrong documentation/function names



Thank you for your answer.

I was able to pinpoint the problem - it is not a bug but it is a quite confusing implementation so I would advise to change it.
Here goes :

When using an zxz rotation (Implemented in FixedZXZ object) then :
A) When you print the object it will print the angles in this order : psi , theta , phi

Proof (From imp/modules/algebra/include/Rotation3D.h)

FixedZXZ() {}
  FixedZXZ(double psi, double theta, double phi) {
    v_[0] = psi;
    v_[1] = theta;
    v_[2] = phi;
  }
  double get_psi() const { return v_[0]; }
  double get_theta() const { return v_[1]; }
  double get_phi() const { return v_[2]; }
  IMP_SHOWABLE_INLINE(FixedZXZ, {
    out << v_[0] << " " << v_[1] << " " << v_[2];
  });

-----

But when using the function get_rotation_from_fixed_zxz(double phi, double theta, double psi) to create
such a rotation, you provide it with the Euler angles in a different order : phi-theta-psi

This causes in a situation in which writing the rotations to a file and reading them back (while assuming
the same order of angles) caused me to get a different transform and producing wrong results.

Not a bug but quite confusing. BTW, When using the ZYZ variant the order IS the same so there is no such problem.

Could you confirm my understanding?
Thank you,
Dany




On 15 July 2013 21:22, Daniel Russel <" target="_blank">> wrote:
Sorry about the confusion. The Euler angle support has been added in a fairly ad hoc manner and is not extremely coherent or consistent. I think part of this is intrinsic to Euler angles as there are lots of conventions used in different places. You can see some more discussion about what to do with them at <https://github.com/salilab/imp/issues/303>. We didn't really come to any solid consensus on where to go.


Hello all,

Please refer to Rotation3D.h
I add my remarks, all starting by XXXXXX :


/** \name Euler Angles
    There are many conventions for how to define Euler angles, based on choices
    of which of the x,y,z axis to use in what order and whether the rotation
    axis is in the body frame (and hence affected by previous rotations) or in
    in a fixed frame. See
    http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
    for a general description.

    - All Euler angles are specified in radians.
    - The names are all \c rotation_from_{fixed/body}_abc() where abc is the
    ordering of x,y,z.
    @{
*/

XXXXXX According to that, functions with the word "fixed" in their name should
XXXXXX Use the Lab fixed axis for rotations and NOT the new axis.

//! Initialize a rotation in x-y-z order from three angles
/** \param[in] xr Rotation around the X axis in radians
    \param[in] yr Rotation around the Y axis in radians
    \param[in] zr Rotation around the Z axis in radians
    \note The three rotations are represented in the original (fixed)
    coordinate frame.
    See Rotation3D
    See FixedXYZ
*/
IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_xyz(double xr, double yr,
                                                        double zr);

XXXXXX The above function complies with the above rule

//! Initialize a rotation from euler angles
/**
   \param[in] phi   Rotation around the Z axis in radians
   \param[in] theta Rotation around the X axis in radians
   \param[in] psi   Rotation around the Z axis in radians
   \note The first rotation is by an angle phi about the z-axis.
   The second rotation is by an angle theta in [0,pi] about the
   former x-axis , and the third rotation is by an angle psi
   about the former z-axis.
   See Rotation3D
*/
IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_zxz(double phi,
                                                        double theta,
                                                        double psi);

XXXXXX I'm not sure what "former" means here, but probably this function complies too.
XXXXXX Don't understand why angle parameter names are so different here

//! Generate a rotation object from Euler Angles
/** \note The first rotation is by an angle about the z-axis.
    The second rotation is by an angle about the new y-axis.
    The third rotation is by an angle about the new z-axis.
    \param[in] Rot First Euler angle (radians) defining the rotation (Z axis)
    \param[in] Tilt Second Euler angle (radians) defining the rotation (Y axis)
    \param[in] Psi Third Euler angle (radians) defining the rotation (Z axis)
    See Rotation3D
    See FixedZYZ
*/
IMPALGEBRAEXPORT Rotation3D get_rotation_from_fixed_zyz(double Rot, double Tilt,
                                                        double Psi);

XXXXXX This function is also called fixed but clearly says it is using the NEW axis.


I'm confused and add to that , the fact that the results of these functions seem to be different than the ones produced by Chimera's rotate function so I'm in a problem here.

Thank you,
Dany


_______________________________________________
IMP-users mailing list
" target="_blank">
https://salilab.org/mailman/listinfo/imp-users



_______________________________________________
IMP-users mailing list
">
https://salilab.org/mailman/listinfo/imp-users