
What is Chimera's trigonometry convention ? How can get angles out of the rotation matrix (saved with "matrixget") ? Jean-Fran�ois M�n�tret, PhD Boston University School of Medicine Physiology and Biophysics Department 700 Albany Street W315 Boston, MA 02118 Email: menetret@bu.edu Mailing address: 715 Albany Street

Hi Jean-Francois, The Chimera matrixget command writes out a 3 by 4 matrix to a file like: Model 0.0 0.440056 0.454627 0.774381 -31.4343 0.0100309 0.859825 -0.51049 20.8174 -0.897914 0.232412 0.373811 25.777 The first 3 columns are a 3 by 3 rotation matrix and the 4th column is an amount to translate. This matrix tells how to rotate and translate the original data set to its current position in the Chimera coordinate system. Another way to look at it is that the data set x-axis is pointed in the direction of the first column of this matrix in the Chimera coordinate system. In the above case the data set x-axis is oriented in direction (0.440056, 0.0100309, -0.897914) in Chimera coordinates, so pointed roughly in the -z direction which is into the screen. I'm not sure what angles you want. We don't have a routine to produce Euler angles from the rotation matrix although the formulas could be found in a textbook. If you want Euler angles, I can probably look it up and give you some Python code that will report those directly from Chimera. Another possibility is to get the axis and amount of rotation for the above rotation matrix. That is can also easily be done using Python in Chimera. Let me know if you are interested in those details. Tom

Hi Tom, thank you for your answer, I found these formulas to get the angles out of the rotation matrix [xx, yx, zx, px; xy, yy, zy, py; xz, yz, zz, pz;] roll (rotation around z) : atan2(xy, xx) pitch (rotation around y) : -arcsin(xz) yaw (rotation around x) : atan2(yz,zz) (from http://www.codeguru.com/forum/archive/index.php/t-329530.html) Now I am trying to go from these angles (yaw,pitch,roll) to euler angles. ... and IT IS NOT easy ... :^) I would appreciate any help Jean-Francois On Mon, 3 Apr 2006, Thomas Goddard wrote:
Hi Jean-Francois, The Chimera matrixget command writes out a 3 by 4 matrix to a file like: Model 0.0 0.440056 0.454627 0.774381 -31.4343 0.0100309 0.859825 -0.51049 20.8174 -0.897914 0.232412 0.373811 25.777
The first 3 columns are a 3 by 3 rotation matrix and the 4th column is an amount to translate. This matrix tells how to rotate and translate the original data set to its current position in the Chimera coordinate system. Another way to look at it is that the data set x-axis is pointed in the direction of the first column of this matrix in the Chimera coordinate system. In the above case the data set x-axis is oriented in direction (0.440056, 0.0100309, -0.897914) in Chimera coordinates, so pointed roughly in the -z direction which is into the screen.
I'm not sure what angles you want. We don't have a routine to produce Euler angles from the rotation matrix although the formulas could be found in a textbook. If you want Euler angles, I can probably look it up and give you some Python code that will report those directly from Chimera. Another possibility is to get the axis and amount of rotation for the above rotation matrix. That is can also easily be done using Python in Chimera. Let me know if you are interested in those details.
Tom

On Mon, 3 Apr 2006, Thomas Goddard wrote:
Hi Jean-Francois,
The Chimera matrixget command writes out a 3 by 4 matrix to a file like:
Model 0.0 0.440056 0.454627 0.774381 -31.4343 0.0100309 0.859825 -0.51049 20.8174 -0.897914 0.232412 0.373811 25.777
The first 3 columns are a 3 by 3 rotation matrix and the 4th column is an amount to translate. This matrix tells how to rotate and translate the original data set to its current position in the Chimera coordinate system. Another way to look at it is that the data set x-axis is pointed in the direction of the first column of this matrix in the Chimera coordinate system. In the above case the data set x-axis is oriented in direction (0.440056, 0.0100309, -0.897914) in Chimera coordinates, so pointed roughly in the -z direction which is into the screen.
I'm not sure what angles you want. We don't have a routine to produce Euler angles from the rotation matrix although the formulas could be found in a textbook. If you want Euler angles, I can probably look it up and give you some Python code that will report those directly from Chimera. Another possibility is to get the axis and amount of rotation for the above rotation matrix. That is can also easily be done using Python in Chimera. Let me know if you are interested in those details.
Tom
In other words, chimera uses a right-handed coordinate system, and there is an implicit forth row containing (0 0 0 1). If you were to transform a point using the matrix, you would write it as a column vector (x y z 1)T to the right of the matrix. The 4x4 matrix is a homogeneous transformation matrix that combines both rotation and translation. The chimera form matches math and physics uses of rotation matrices, and the transpose matches the form in many computer graphics texts. - Greg

Hi Jean-Francois, The following web page gives a short block of code that determines Euler angles (called heading, attitude, and bank on that page) http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToE... That page also wisely suggests that you shouldn't convert to Euler angles unless you have to -- for example if you are using a program that will only accept Euler angles. They have bad characteristics -- different sets of Euler angles can be used to represent the same rotation. Tom
participants (3)
-
Greg Couch
-
jean-francois menetret
-
Thomas Goddard