[Chimera-users] Feature Request: Expose rotation to python
goddard at cgl.ucsf.edu
Mon Nov 28 09:56:15 PST 2005
I second your request for having a Xform.getMatrix() method that
provides 3x4 Numeric array or tuple of tuples.
I use this a good bit. My solution is to use the Chimera
PDBmatrices.matrices module which deals with 3x4 matrices where the
first 3 columns are the rotation and the last column is the
translation. It's been in Chimera for the last couple years
(with ocassional changes).
Look at Python code
to see what is there.
>>> xf = chimera.Xform.zRotation(30)
>>> from PDBmatrices import matrices
>>> m = matrices.xform_matrix(xf)
>>> print m
((0.866025, -0.5, 0.0, 0.0),
(0.5, 0.866025, 0.0, 0.0),
(0.0, 0.0, 1.0, 0.0))
There is a chimera_xform() routine to go from matrix to Xform, and
other routines to apply 3x4 matrices to points, or vectors, invert matrices,
multiply matrices, ....
More information about the Chimera-users