Friday, August 10, 2018

Finding the Quaternion Needed to Do a Specified Rotation in a Given Plane


  Since there is no help available for user defined functions it's easier to use mnemonic names for them involving their variables in the correct order. The functions below are some of the common operations performed with quaternions. The conjugate of a quaternion is defined as a quaternion with the same scalar part but with the the signs of the vector parts changed. The square of the magnitude of quaternion a equals a*a. A simple way to find the quaternion b/a is to multiply both the numerator and denominator by the conjugate of the denominator so we have b/a=a*b/a*a and the division is reduced to a division by a scalar. The range pointer p is assumed to take the integer values from 1 to 4.


To define a plane through the origin one needs two additional points in the plane. Let a be a unit quaternion in the direction in which the desired plane crosses the x,y-plane. And let b be a second unit quaternion at angle φ in the x,y-plane. The quaternion that will rotate a to b is q=b/a. Suppose next we look for another rotation with fixed φ that will take a'=b to b' or q'=b'/a'. Combining the two rotations we get r=q'q which specifies the direction of the normal to the plane of rotation and with the magnitude of the vector part equal to the sine of the angle of rotational step. If we want to switch to a new step size we need to divide r by the sine of the first step and multiply by the sine of the new step which we will take to be Δθ=2π/24. The rotations used to define the plane of rotation are the angles used in spherical coordinates but one could use Euler angles instead. In general one just needs two quaternions specifying two points in the plane of rotation.


Repeatedly multiplying the starting position a by the modified r results in the following plot. The quaternions i, j, k are included to show the relative orientation of the observer and r is the required modified rotation quaternion.


No comments:

Post a Comment