[Chimera-users] Feature Request: Expose rotation to python
Thomas Goddard
goddard at cgl.ucsf.edu
Mon Nov 28 09:56:15 PST 2005
Hi Charlie,
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
chimera/share/PDBmatrices/matrices.py
to see what is there.
Example,
>>> 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, ....
Tom
More information about the Chimera-users
mailing list