Skip to content

rotation.m

Basic Information

  SYNTAX:
         [rot]= rotation(dir_cos,alpha);

  PURPOSE:
  Generate rotation matrix (rot) [3x3] in 3-D Euclidean space {X,Y,Z}
  for rotation of [x,y,z] objects about line described by direction cosines
  (dir_cos) [3x1] thru angle (alpha) {degrees}.
  Use of rotational transform is:  [X_new,Y_new,Z_new] = [X, Y, Z] * a

  INPUT:
        dir_cos= row or column vector of length 3 which contains the
                 direction vector or direction cosine of line to rotate about.
                 The direction vector is [dx,dy,dz] along line or [x,y,z]
                 note: rotation is about + direction of line
        alpha=   angle in degrees to rotate using the right hand rule

  OUTPUT:
        rot=     Rotational transform matrix [3x3]

  NOTE: This rotates the coordinate system. To rotate object use -alpha

Dependencies