# Created by Octave 3.6.1, Mon Apr 02 12:18:12 2012 UTC # name: cache # type: cell # rows: 3 # columns: 5 # name: # type: sq_string # elements: 1 # length: 5 q2rot # name: # type: sq_string # elements: 1 # length: 814 -- Function File: [AXIS, ANGLE] = q2rot (Q) Extract vector/angle form of a unit quaternion Q. *Inputs* Q Unit quaternion describing the rotation. *Outputs* AXIS Eigenaxis as a 3-d unit vector `[x, y, z]'. ANGLE Rotation angle in radians. The positive direction is determined by the right-hand rule applied to AXIS. *Example* octave:1> axis = [0, 0, 1] axis = 0 0 1 octave:2> angle = pi/4 angle = 0.78540 octave:3> q = rot2q (axis, angle) q = 0.9239 + 0i + 0j + 0.3827k octave:4> [vv, th] = q2rot (q) vv = 0 0 1 th = 0.78540 octave:5> theta = th*180/pi theta = 45.000 octave:6> # name: # type: sq_string # elements: 1 # length: 49 Extract vector/angle form of a unit quaternion Q. # name: # type: sq_string # elements: 1 # length: 2 qi # name: # type: sq_string # elements: 1 # length: 355 @deftypefn {Function File} {} qi Create x-component of a quaternion's vector part. @example q = w + x*qi + y*qj + z*qk @end example @strong{Example} @example @group octave:1> q1 = quaternion (1, 2, 3, 4) q1 = 1 + 2i + 3j + 4k octave:2> q2 = 1 + 2*qi + 3*qj + 4*qk q2 = 1 + 2i + 3j + 4k octave:3> @end group @end example @end deftypefn # name: # type: sq_string # elements: 1 # length: 80 @deftypefn {Function File} {} qi Create x-component of a quaternion's vector p # name: # type: sq_string # elements: 1 # length: 2 qj # name: # type: sq_string # elements: 1 # length: 355 @deftypefn {Function File} {} qj Create y-component of a quaternion's vector part. @example q = w + x*qi + y*qj + z*qk @end example @strong{Example} @example @group octave:1> q1 = quaternion (1, 2, 3, 4) q1 = 1 + 2i + 3j + 4k octave:2> q2 = 1 + 2*qi + 3*qj + 4*qk q2 = 1 + 2i + 3j + 4k octave:3> @end group @end example @end deftypefn # name: # type: sq_string # elements: 1 # length: 80 @deftypefn {Function File} {} qj Create y-component of a quaternion's vector p # name: # type: sq_string # elements: 1 # length: 2 qk # name: # type: sq_string # elements: 1 # length: 355 @deftypefn {Function File} {} qk Create z-component of a quaternion's vector part. @example q = w + x*qi + y*qj + z*qk @end example @strong{Example} @example @group octave:1> q1 = quaternion (1, 2, 3, 4) q1 = 1 + 2i + 3j + 4k octave:2> q2 = 1 + 2*qi + 3*qj + 4*qk q2 = 1 + 2i + 3j + 4k octave:3> @end group @end example @end deftypefn # name: # type: sq_string # elements: 1 # length: 80 @deftypefn {Function File} {} qk Create z-component of a quaternion's vector p # name: # type: sq_string # elements: 1 # length: 5 rot2q # name: # type: sq_string # elements: 1 # length: 1058 -- Function File: Q = rot2q (AXIS, ANGLE) Create unit quaternion Q which describes a rotation of ANGLE radians about the vector AXIS. This function uses the active convention where the vector AXIS is rotated by ANGLE radians. If the coordinate frame should be rotated by ANGLE radians, also called the passive convention, this is equivalent to rotating the AXIS by -ANGLE radians. *Inputs* AXIS Vector `[x, y, z]' describing the axis of rotation. ANGLE Rotation angle in radians. The positive direction is determined by the right-hand rule applied to AXIS. *Outputs* Q Unit quaternion describing the rotation. *Example* octave:1> axis = [0, 0, 1]; octave:2> angle = pi/4; octave:3> q = rot2q (axis, angle) q = 0.9239 + 0i + 0j + 0.3827k octave:4> v = quaternion (1, 1, 0) v = 0 + 1i + 1j + 0k octave:5> vr = q * v * conj (q) vr = 0 + 0i + 1.414j + 0k octave:6> # name: # type: sq_string # elements: 1 # length: 80 Create unit quaternion Q which describes a rotation of ANGLE radians about the v