[Chimera-users] Feature Request: Expose rotation to python
Charlie Moad
cwmoad at gmail.com
Mon Nov 28 10:48:57 PST 2005
Then would this be a practical solution:
matrices.xform_matrix(chimera.openModels.list()[0].openState.xform)
On 11/28/05, Thomas Goddard <goddard at cgl.ucsf.edu> wrote:
> 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