# [Chimera-users] trigonometry

jean-francois menetret menetret at bu.edu
Mon Apr 3 11:47:27 PDT 2006

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
>