[Chimera-users] Rotation about an axis
Jordan Benjamin
jordan.benjamin at gmail.com
Tue Apr 11 16:38:04 PDT 2006
I'm trying to rotate a model about a specified axis and origin
(preferably in global coordinates). I would like the rotation to be
applied on top of whatever transformations have been applied already.
I've looked at the documentation, including the programmer's FAQ and
the source code for ConstrainedMove. I couldn't figure out how to do
this, so I wrote the following function based on the ConstrainedMove
code to do the rotation relative to another model:
def rotate_around_model_axis(ref_model, model, origin, axis, angle_deg):
mvo = apply(chimera.Vector, origin)
vo = ref_model.openState.xform.apply(mvo)
mva = apply(chimera.Vector, axis)
va = ref_model.openState.xform.apply(mva)
xf = chimera.Xform()
xf.translate(vo)
xf.rotate(va, angle_deg)
xf.translate(-vo)
model.openState.globalXform(xf)
But, this doesn't seem to work as I'd intended. Is there a way to do
this? Also, I'm a little confused about the coordinate system. It
seems like the concept of a global coordinate system may not apply in
Chimera the way I'm used to (like in Amira for example) since the
camera is fixed. Is this true, or am I totally lost? Thanks in advance
for any help you can provide.
Jordan
More information about the Chimera-users
mailing list