Re: [chimera-dev] question about rotations/translations in Chimera
Hi Julio,
Chimera Python and C++ code represent rotations and translations as 3 row by 4 column matrices with the first 3 columns being a rotation matrix and the 4th column being a translation. The rotation is applied first (about 0,0,0) then the translation.
Each map and atomic model in Chimera has its own local coordinate system. The placement of the local coordinate frame in the Chimera global coordinate system (z axis points out of screen, x axis horizontal on screen) is given by one of these 3x4 transformation matrices.
The origin of the local coordinate system can be at any point relative to the data. It does not need to be at the corner of the map, nor in the center of the map. The position is specified in the header of many of the map file formats (e.g. MRC). With atomic models (PDB files) from crystallography the origin is usually the crystallographic origin (used for crystallographic point symmetry).
There is a 3x4 transform describing how the local coordinate frame is positioned in the global coordinate system. Also for maps there is another 3x4 transform that describes how the grid is positioned within the local coordinate system. This latter transform determines where the data sits in the local coordinate frame the actual data -- the shift is determined by the origin values in map headers. The ability to rotate the grid within the local coordinate frame is generally not supported by map file formats. So if you want to save a rotated map you generally have to resample on a rotated grid -- unfortunate.
The Chimera command language allows specifying rotations and translations with the "turn" and "move" commands. These do not use a 3x4 matrix since that is not very useful for hand-typed commands. Instead you can specify the center for a rotation, an axis vector and an angle. For example
turn 1,1,0 30 center 150,245.5,90 coordinateSystem #0 model #1
rotates model #1 about axis (1,1,0) by 30 degrees about with center (150,245.5,90) where the axis and center are in the local coordinate system of model #0.
There's a lot to know about how coordinate systems are handled in Chimera and I'd need a more specific question to advise you further. Here's a little info about transforms in Python
http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html#q5
And here's some about the "turn" and "move" commands
http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/turn.html
http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/move.html
Tom
Dear Prof. Goddard,
I came recently to Pawel's group in UT Houston, and we were wondering about how Chimera performs rotations and translations: in which order, and with respect to which point (center of the map, origin of coordinates, corner of the map...)?
Any info that you can provide to help us clarify this will be greatly appreciated.
Best regards, Julio
participants (1)
-
Thomas Goddard