Skip to content

rot_obj.m

Basic Information

  SYNTAX:
         [x,y,z]= rot_obj(x,y,z,dir_cos,alpha,origin);

  PURPOSE:
  Rotation of an object described by [x,y,z] coordinates in 3-D Euclidean
  space, {X,Y,Z}, about a line described by direction cosines (dir_cos) [3x1]
  and passing thru origin [3x1] thru angle (alpha) {degrees}.

  INPUT:
        x,y,z=   x,y,z coordinates of object, {vector or matrix allowed}
                 note: x,y,z must all be the same size
        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
        origin=  Vector [3] containing the origin about which to rotate
                 Note: if origin is not present it assumes [0,0,0]

  OUTPUT:
        x,y,z=   new coordinates of object following rotation

Dependencies