ok guys - let me work it out.
So the requirements so far are:
constructors:
1: Any rotation convention (at least X-Y-Z and Z-Y-Z)
BEN: what is used in modeller?
2: r otate around any axis for example (1,1,0),x - meaning rotating around the diagonal of the XY plane in x radians
any other specification I am missing?
please reply and I'll try to post some alternatives tomorrow - want to think about it a bit more.
On Nov 12, 2008, at 7:15 PM, Javier Ángel Velázquez Muriel wrote:
I don't like the convention x-y-z for the Euler angles and we absolutely need to be consistent around IMP about them or enforce clear specification. The most used one in EM by far is ZYZ and the one that I am going to use. Javi2008/11/12 <imp-dev-requestATsalilab.org ">imp-dev-requestATsalilab.org >: Send IMP-dev mailing list submissions to imp-devATsalilab.org ">imp-devATsalilab.org To subscribe or unsubscribe via the World Wide Web, visit https://salilab.org/mailman/listinfo/imp-dev or, via email, send a message with subject or body 'help' to imp-dev-requestATsalilab.org ">imp-dev-requestATsalilab.org You can reach the person managing the list at imp-dev-ownerATsalilab.org ">imp-dev-ownerATsalilab.org When replying, please edit your Subject line so it is more specific than "Re: Contents of IMP-dev digest..." Today's Topics: 1. Re: [IMP-commits] r854 - trunk/modules/misc/include (Dina Schneidman) 2. Re: [IMP-commits] r854 - trunk/modules/misc/include (Daniel Russel) 3. Re: 2D geometry ( Javier ?ngel Vel?zquez Muriel ) 4. Re: 2D geometry ( Javier ?ngel Vel?zquez Muriel ) 5. Re: 2D geometry (Daniel Russel) 6. Re: 2D geometry (Daniel Russel) 7. Re: 2D geometry (Keren Lasker) ---------------------------------------------------------------------- Message: 1 Date: Wed, 12 Nov 2008 15:59:13 -0800 From: "Dina Schneidman" <duhovkaATgmail.com ">duhovkaATgmail.com > Subject: Re: [IMP-dev] [IMP-commits] r854 - trunk/modules/misc/include To: "List for IMP development" <imp-devATsalilab.org ">imp-devATsalilab.org > Message-ID: <55d63ce50811121559p4995f334kf9e9c1247f21d35fATmail.gmail.com ">55d63ce50811121559p4995f334kf9e9c1247f21d35fATmail.gmail.com > Content-Type: text/plain; charset="iso-8859-1" I think these are Euler angles. http://www.euclideanspace.com/maths/algebra/matrix/orthogonal/rotation/index.htm Daniel, I agree that conceptually it is wrong to store them in Vector3D, but it is very convenient in practice. On Wed, Nov 12, 2008 at 10:33 PM, Keren Lasker <kerenlATsalilab.org ">kerenlATsalilab.org > wrote: Daniel - the angles are not Euler angles but just three angles around X/Y/Z axis. Would you like the option to rotate around another axis, ,something like: (1,1,0),45 - meaning rotating around the diagonal of the XY plane in 45 degrees? On Nov 12, 2008, at 5:43 PM, Daniel Russel wrote: I don't like having two equivalent constructors from thevsame data or using a vector to hold angles. What I had meant with my suggestion is initialization from an axis and an amount of rotation about that axis as that is a somewhat less problematic basis than Euler angles (and one I use :-) On Nov 12, 2008, at 2:31 PM, Notification of IMP commits < imp-commitsATsalilab.org ">imp-commitsATsalilab.org wrote: Author: kerenlATSALILAB.ORG ">kerenlATSALILAB.ORG Date: 2008-11-12 14:31:59 -0800 (Wed, 12 Nov 2008) New Revision: 854 Modified: trunk/modules/misc/include/Rotation3D.h Log: 1. Change protected to private 2. Add constructors from Vector3D and an angle 3. update documentation Modified: trunk/modules/misc/include/Rotation3D.h =================================================================== --- trunk/modules/misc/include/Rotation3D.h 2008-11-12 21:15:36 UTC (rev 853) +++ trunk/modules/misc/include/Rotation3D.h 2008-11-12 22:31:59 UTC (rev 854) @@ -19,26 +19,28 @@ class IMPMISCEXPORT Rotation3D { public: - //! Initialize a rotation in x-y-z order from three angles + Rotation3D(){ + } + //! Initialize a rotation in x-y-z order from three Euler angles /** \param[in] xr Rotation around the X axis \param[in] yr Rotation around the Y axis \param[in] zr Rotation around the Z axis */ Rotation3D(Float xr, Float yr, Float zr) { - Float cx = cos(xr); Float cy = cos(yr); Float cz = cos(zr); - Float sx = sin(xr); Float sy = sin(yr); Float sz = sin(zr); - Float m00 = cz*cy; - Float m11 = -sy*sx*sz + cx*cz; - Float m22 = cy*cx; - quat_[0] = sqrt(1+m00+m11+m22)/2.0; - quat_[1] = sqrt(1+m00-m11-m22)/2.0; - quat_[2] = sqrt(1-m00+m11-m22)/2.0; - quat_[3] = sqrt(1-m00-m11+m22)/2.0; - if (cy*sx + sy*cx*sz + sx*cz < 0.0) quat_[1] = -quat_[1]; - if (sz*sx - sy*cx*cz - sy < 0.0) quat_[2] = -quat_[2]; - if (sz*cy + sy*sx*cz + sz*cx < 0.0) quat_[3] = -quat_[3]; + init_angles(xr,yr,zr); } - + //! Initialize a rotation in x-y-z order from three identical Euler angles + /** \param[in] e_angle Rotation around first the X axis, Y axis and Z axis + */ + Rotation3D(Float e_angle){ + init_angles(e_angle, e_angle, e_angle); + } + //! Initialize a rotation in x-y-z order from three Euler angles + /** \param[in] v A vector that holds three Euler angles (x-y-z order) + */ + Rotation3D(const Vector3D &v){ + init_angles(v[0],v[1],v[2]); + } Matrix3D get_matrix() const { const Float a = quat_[0]; const Float b = quat_[1]; @@ -76,7 +78,22 @@ return atan2(matrix21(), matrix11()); } -protected: +private: + void init_angles(Float xr, Float yr, Float zr) { + Float cx = cos(xr); Float cy = cos(yr); Float cz = cos(zr); + Float sx = sin(xr); Float sy = sin(yr); Float sz = sin(zr); + Float m00 = cz*cy; + Float m11 = -sy*sx*sz + cx*cz; + Float m22 = cy*cx; + quat_[0] = sqrt(1+m00+m11+m22)/2.0; + quat_[1] = sqrt(1+m00-m11-m22)/2.0; + quat_[2] = sqrt(1-m00+m11-m22)/2.0; + quat_[3] = sqrt(1-m00-m11+m22)/2.0; + if (cy*sx + sy*cx*sz + sx*cz < 0.0) quat_[1] = -quat_[1]; + if (sz*sx - sy*cx*cz - sy < 0.0) quat_[2] = -quat_[2]; + if (sz*cy + sy*sx*cz + sz*cx < 0.0) quat_[3] = -quat_[3]; + } + Float matrix11() const { return sqr(quat_[0]) + sqr(quat_[1]) - sqr(quat_[2]) - sqr(quat_[3]); } _______________________________________________ IMP-commits mailing list IMP-commitsATsalilab.org ">IMP-commitsATsalilab.org https://salilab.org/mailman/listinfo/imp-commits _______________________________________________ IMP-dev mailing list IMP-devATsalilab.org ">IMP-devATsalilab.org https://salilab.org/mailman/listinfo/imp-dev _______________________________________________ IMP-dev mailing list IMP-devATsalilab.org ">IMP-devATsalilab.org https://salilab.org/mailman/listinfo/imp-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: https://salilab.org/mailman/private/imp-dev/attachments/20081112/de795697/attachment.html ------------------------------ Message: 2 Date: Wed, 12 Nov 2008 15:59:26 -0800 From: Daniel Russel <drusselATgmail.com ">drusselATgmail.com > Subject: Re: [IMP-dev] [IMP-commits] r854 - trunk/modules/misc/include To: List for IMP development <imp-devATsalilab.org ">imp-devATsalilab.org > Message-ID: <9A27C079-74F3-4390-89F3-0630AEF130B7ATgmail.com ">9A27C079-74F3-4390-89F3-0630AEF130B7ATgmail.com > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes look at the latest version of Rotation3D class - I added some documentation on quaternions Sure, but why do we support construction from the (possibly) Euler angles at all? ------------------------------ Message: 3 Date: Wed, 12 Nov 2008 16:02:23 -0800 From: " Javier ?ngel Vel?zquez Muriel " <javiATsalilab.org ">javiATsalilab.org > Subject: Re: [IMP-dev] 2D geometry To: "Daniel Russel" <drusselATgmail.com ">drusselATgmail.com > Cc: List for IMP development <imp-devATsalilab.org ">imp-devATsalilab.org >, embed-devATsalilab.org ">embed-devATsalilab.org Message-ID: <598e2cdc0811121602h32663187m52e14c51e0243e4aATmail.gmail.com ">598e2cdc0811121602h32663187m52e14c51e0243e4aATmail.gmail.com > Content-Type: text/plain; charset=ISO-8859-1 2008/11/12 Daniel Russel <drusselATgmail.com ">drusselATgmail.com >: Or vector and matrix can be replaced by a single version templated on the dimension. We definitely don't want separate code bases for the 2 and 3D versions as it will be a pain to keep the set of operations in sync. On Nov 12, 2008, at 10:50 PM, Keren Lasker wrote: Javi, For your 2D geometry classes (Vector2D, Matrix2D ...) - why not just using the corresponding 3D classes and keeping Z fixed? I think it is not too bad in performance and will save you a lot of coding/debugging time. Keren. _______________________________________________ IMP-dev mailing list IMP-devATsalilab.org ">IMP-devATsalilab.org https://salilab.org/mailman/listinfo/imp-dev ------------------------------ Message: 4 Date: Wed, 12 Nov 2008 16:02:42 -0800 From: " Javier ?ngel Vel?zquez Muriel " <javiATsalilab.org ">javiATsalilab.org > Subject: Re: [IMP-dev] 2D geometry To: "Daniel Russel" <drusselATgmail.com ">drusselATgmail.com > Cc: List for IMP development <imp-devATsalilab.org ">imp-devATsalilab.org >, embed-devATsalilab.org ">embed-devATsalilab.org Message-ID: <598e2cdc0811121602y4cacb332t7603c6b3f0bc519aATmail.gmail.com ">598e2cdc0811121602y4cacb332t7603c6b3f0bc519aATmail.gmail.com > Content-Type: text/plain; charset=ISO-8859-1 - Vector2D is already done but I am fine with changes - I am building a templated version of matrix for 1,2,3D. I didn't know about matrix3d until yesterday - Images are going to be 2D matrices and header. 2008/11/12 Daniel Russel <drusselATgmail.com ">drusselATgmail.com >: Or vector and matrix can be replaced by a single version templated on the dimension. We definitely don't want separate code bases for the 2 and 3D versions as it will be a pain to keep the set of operations in sync. On Nov 12, 2008, at 10:50 PM, Keren Lasker wrote: Javi, For your 2D geometry classes (Vector2D, Matrix2D ...) - why not just using the corresponding 3D classes and keeping Z fixed? I think it is not too bad in performance and will save you a lot of coding/debugging time. Keren. _______________________________________________ IMP-dev mailing list IMP-devATsalilab.org ">IMP-devATsalilab.org https://salilab.org/mailman/listinfo/imp-dev ------------------------------ Message: 5 Date: Wed, 12 Nov 2008 16:04:22 -0800 From: Daniel Russel <drusselATgmail.com ">drusselATgmail.com > Subject: Re: [IMP-dev] 2D geometry To: "Javier ?ngel Vel?zquez-Muriel" <javi.velazquezATgmail.com ">javi.velazquezATgmail.com > Cc: List for IMP development <imp-devATsalilab.org ">imp-devATsalilab.org >, embed-devATsalilab.org ">embed-devATsalilab.org Message-ID: <15ADFC5D-2B21-4120-ABD2-87357AEB2FA0ATgmail.com ">15ADFC5D-2B21-4120-ABD2-87357AEB2FA0ATgmail.com > Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes On Nov 12, 2008, at 3:58 PM, Javier ?ngel Vel?zquez-Muriel wrote: - Vector2D is already done but I am fine with changes Lets make a unified ND vector. I have wanted 4D a bunch of times. - I am building a templated version of matrix for 1,2,3D. I didn't know about matrix3d until yesterday If you want nice constructors (from lists of values) you can use the boost static assert functionality to make sure, at compile time, that the correct constructor is called for the correct dimensional vector/ matrix. - Images are going to be 2D matrices and header. BTW, have you looked at Boost.GIL? It is a general C++ image library in boost (which we are already linked against, in theory). 2008/11/12 Daniel Russel <drusselATgmail.com ">drusselATgmail.com >: Or vector and matrix can be replaced by a single version templated on the dimension. We definitely don't want separate code bases for the 2 and 3D versions as it will be a pain to keep the set of operations in sync. On Nov 12, 2008, at 10:50 PM, Keren Lasker wrote: Javi, For your 2D geometry classes (Vector2D, Matrix2D ...) - why not just using the corresponding 3D classes and keeping Z fixed? I think it is not too bad in performance and will save you a lot of coding/debugging time. Keren. _______________________________________________ IMP-dev mailing list IMP-devATsalilab.org ">IMP-devATsalilab.org https://salilab.org/mailman/listinfo/imp-dev ------------------------------ Message: 6 Date: Wed, 12 Nov 2008 16:05:45 -0800 From: Daniel Russel <drusselATgmail.com ">drusselATgmail.com > Subject: Re: [IMP-dev] 2D geometry To: "Javier ?ngel Vel?zquez Muriel" <javiATsalilab.org ">javiATsalilab.org > Cc: List for IMP development <imp-devATsalilab.org ">imp-devATsalilab.org >, embed-devATsalilab.org ">embed-devATsalilab.org Message-ID: <63DCF487-8D99-4325-A604-DC4EBF6E352DATgmail.com ">63DCF487-8D99-4325-A604-DC4EBF6E352DATgmail.com > Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes I can templatize the current Vector3D tonight (actually, I had already done so a while ago, so I just have to resuscitate it). On Nov 12, 2008, at 4:02 PM, Javier ?ngel Vel?zquez Muriel wrote: - Vector2D is already done but I am fine with changes - I am building a templated version of matrix for 1,2,3D. I didn't know about matrix3d until yesterday - Images are going to be 2D matrices and header. 2008/11/12 Daniel Russel <drusselATgmail.com ">drusselATgmail.com >: Or vector and matrix can be replaced by a single version templated on the dimension. We definitely don't want separate code bases for the 2 and 3D versions as it will be a pain to keep the set of operations in sync. On Nov 12, 2008, at 10:50 PM, Keren Lasker wrote: Javi, For your 2D geometry classes (Vector2D, Matrix2D ...) - why not just using the corresponding 3D classes and keeping Z fixed? I think it is not too bad in performance and will save you a lot of coding/debugging time. Keren. _______________________________________________ IMP-dev mailing list IMP-devATsalilab.org ">IMP-devATsalilab.org https://salilab.org/mailman/listinfo/imp-dev ------------------------------ Message: 7 Date: Thu, 13 Nov 2008 02:08:34 -0500 From: Keren Lasker <kerenlATsalilab.org ">kerenlATsalilab.org > Subject: Re: [IMP-dev] 2D geometry To: List for IMP development <imp-devATsalilab.org ">imp-devATsalilab.org > Cc: "Javier ?ngel Vel?zquez Muriel" <javiATsalilab.org ">javiATsalilab.org >, embed-devATsalilab.org ">embed-devATsalilab.org Message-ID: <CE87CC11-878D-4882-87EC-4CFD1F47106AATsalilab.org ">CE87CC11-878D-4882-87EC-4CFD1F47106AATsalilab.org > Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes sounds good ! Lets decide on an interface for the geometry classes. Ben's Vector3D is a very good start. I'll update the 3D geometry classes accordingly. Javi - do you have any specific needs for the geometry classes or just the basic needs? Maybe you can send your header file so Daniel can take it into account writing the VectorD? On Nov 12, 2008, at 7:05 PM, Daniel Russel wrote: I can templatize the current Vector3D tonight (actually, I had already done so a while ago, so I just have to resuscitate it). On Nov 12, 2008, at 4:02 PM, Javier ?ngel Vel?zquez Muriel wrote: - Vector2D is already done but I am fine with changes - I am building a templated version of matrix for 1,2,3D. I didn't know about matrix3d until yesterday - Images are going to be 2D matrices and header. 2008/11/12 Daniel Russel <drusselATgmail.com ">drusselATgmail.com >: Or vector and matrix can be replaced by a single version templated on the dimension. We definitely don't want separate code bases for the 2 and 3D versions as it will be a pain to keep the set of operations in sync. On Nov 12, 2008, at 10:50 PM, Keren Lasker wrote: Javi, For your 2D geometry classes (Vector2D, Matrix2D ...) - why not just using the corresponding 3D classes and keeping Z fixed? I think it is not too bad in performance and will save you a lot of coding/debugging time. Keren. _______________________________________________ IMP-dev mailing list IMP-devATsalilab.org ">IMP-devATsalilab.org https://salilab.org/mailman/listinfo/imp-dev _______________________________________________ IMP-dev mailing list IMP-devATsalilab.org ">IMP-devATsalilab.org https://salilab.org/mailman/listinfo/imp-dev ------------------------------ _______________________________________________ IMP-dev mailing list IMP-devATsalilab.org ">IMP-devATsalilab.org https://salilab.org/mailman/listinfo/imp-dev End of IMP-dev Digest, Vol 13, Issue 8 ************************************** _______________________________________________ IMP-dev mailing listIMP-devATsalilab.org ">IMP-devATsalilab.org https://salilab.org/mailman/listinfo/imp-dev