Jmol/Quaternions

From Proteopedia

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
-
==Examples==
 
<StructureSection load='' size='340' side='right' caption='' scene='43/433638/Fullview_cartoon/20'>
<StructureSection load='' size='340' side='right' caption='' scene='43/433638/Fullview_cartoon/20'>
 +
 +
==Examples==
http://proteopedia.org/wiki/images/7/76/Wobble.spt
http://proteopedia.org/wiki/images/7/76/Wobble.spt
Line 12: Line 13:
-
==Preliminaries==
+
==Preliminary definitions==
A quaternion ''q'' is an mathematical object (like a matrix or a complex number) with four parameters ''x y z w''. It is useful to express orientations and rotations, and to do calculations (combining, interpolating, dissecting) on them.
A quaternion ''q'' is an mathematical object (like a matrix or a complex number) with four parameters ''x y z w''. It is useful to express orientations and rotations, and to do calculations (combining, interpolating, dissecting) on them.
Line 42: Line 43:
In order to achieve this effect, we have to apply a rotation ''r'' on the orientation ''o''. This is done by quaternion multiplication. The order matters: the right-most rotation is applied first. Here, we first want to rotate the structure from the initial orientation to the current orientation, and then apply the tilting rotation, so the overall orientation becomes ''r'' * ''o''.
In order to achieve this effect, we have to apply a rotation ''r'' on the orientation ''o''. This is done by quaternion multiplication. The order matters: the right-most rotation is applied first. Here, we first want to rotate the structure from the initial orientation to the current orientation, and then apply the tilting rotation, so the overall orientation becomes ''r'' * ''o''.
-
==Interpolating between orientations==
+
==Interpolating between orientations==
 +
 
 +
If you have a quaternion that defines a rotation, and you want to rotate in a stepwise fashion, this is very easy. You just divide the quaternion by the number of steps, and apply that rotation.
 +
 
 +
Here is an example:
 +
<jmol><jmolButton><script>q0 = quaternion(); qr = quaternion({1 1 0}, 90)); rotate quaternion @q</script><text>rotate all the way</text></jmolButton></jmol>
 +
 
 +
<jmol><jmolButton><script>moveto quaternion @q0</script><text>back to last orientation</text></jmolButton></jmol>
 +
 
 +
<jmol><jmolButton><script>q10 = @qr / 10; rotate quaternion @q</script><text>rotate one tenth</text></jmolButton></jmol>
 +
 
==Interpreting a rotation==
==Interpreting a rotation==

Revision as of 14:45, 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