Send IMP-users mailing list submissions to
    ">
To subscribe or unsubscribe via the World Wide Web, visit
    https://salilab.org/mailman/listinfo/imp-users
or, via email, send a message with subject or body 'help' to
    ">
You can reach the person managing the list at
    ">
When replying, please edit your Subject line so it is more specific
than "Re: Contents of IMP-users digest..."
Today's Topics:
 Â1. Re: Rotations and Euler angles - possibly wrong
   documentation/function names (Dan Cohen)
----------------------------------------------------------------------
Message: 1
Date: Tue, 16 Jul 2013 15:56:08 +0300
From: Dan Cohen <">>
To: Help and discussion for users of IMP <">>
Subject: Re: [IMP-users] Rotations and Euler angles - possibly wrong
    documentation/function names
Message-ID:
    <CAECL089r0AkEwebki37Xg5k31+_ZkcwvsHZuWuDE6eCjVh=">>
Content-Type: text/plain; charset="iso-8859-1"
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 <">> 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.
>
>
> On Mon, Jul 15, 2013 at 6:59 AM, Dan Cohen <">> wrote:
>
>> 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
>> ">
>> https://salilab.org/mailman/listinfo/imp-users
>>
>>
>
> _______________________________________________
> IMP-users mailing list
> ">
> https://salilab.org/mailman/listinfo/imp-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://salilab.org/archives/imp-users/attachments/20130716/9b3a7019/attachment.html>
------------------------------
_______________________________________________
IMP-users mailing list
">
https://salilab.org/mailman/listinfo/imp-users
End of IMP-users Digest, Vol 30, Issue 6
****************************************