Jmol/Quaternions

From Proteopedia

(Difference between revisions)
Jump to: navigation, search
Line 50: Line 50:
Relevant Jmol command examples:
Relevant Jmol command examples:
-
r = quaternion({@x @y @z},@tilt) # rotation about an axis in direction xyz by tilt degrees
+
r = quaternion({@x @y @z},@tilt) # rotation about an axis xyz by tilt degrees
-
tilted = r * s # apply the rotation to the starting orientation to get the tilted orientation
+
tilted = r * s # rotate the starting orientation to get the tilted orientation
moveto @time quaternion @tilted # tilt the view, taking some time to do so.
moveto @time quaternion @tilted # tilt the view, taking some time to do so.
Line 76: Line 76:
q0 = quaternion
q0 = quaternion
angle = rotation%"theta" #Extract the rotation angle from the quaternion
angle = rotation%"theta" #Extract the rotation angle from the quaternion
-
angle = 2 * acos(rotation.w) #Alternative way to get the angle, avoids percent sign that gave me trouble
+
angle = 2 * acos(rotation.w) #Alternative way to get the angle, avoids percent sign
duration = angle/45 + 0.1 #take one second per 45 degrees rotation, plus 0.1 sec
duration = angle/45 + 0.1 #take one second per 45 degrees rotation, plus 0.1 sec
qnew = rotation * q0 #figure out the new orientation
qnew = rotation * q0 #figure out the new orientation

Revision as of 16:01, 25 July 2019

Drag the structure with the mouse to rotate

Resources

http://sacredsoftware.net/tutorials/quaternion.html

Proteopedia Page Contributors and Editors (what is this?)

Karsten Theis

Personal tools