[Chimera-users] Feature Request: Expose rotation to python
Thomas Goddard
goddard at cgl.ucsf.edu
Tue Nov 29 10:11:30 PST 2005
Hi Charlie,
To set a model's transformation to the identity:
identity = chimera.Xform()
model.openState.xform = identity
This may throw the model out of view.
To apply a rotation about the z-axis in the model's coordinate system:
zrot = chimera.Xform.zRotation(30) # rotation by 30 degrees
model.openState.localXform(zrot)
To apply a rotation about the screen z-axis:
zrot = chimera.Xform.zRotation(30) # rotation by 30 degrees
model.openState.globalXform(zrot)
The localXform() and globalXform() methods just multiply the current
transformation by the given one (on the right or left) and set the model's
transformation to the result.
The model transformation maps a point in the model coordinate system
to the screen coordinate system (x horizontal, y vertical, z out of
screen) controlling where the model appears on the screen. When you
use localXform(xf) the xf gets applied first, and then the current
transformation. When you use globalXform(xf) the current transform is
applied first and then xf.
Some more examples are given in the Programmer's Guide FAQ:
http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html#q4
Getting the transformation math right can be tricky.
Tom
More information about the Chimera-users
mailing list