Skip to content

z_dircos.m

Basic Information

  SYNTAX:
           rot= z_dircos(dir_cos);

  PURPOSE:
  Find the direction cosines of an axis system (X', Y', Z') with Z' axis
  direction cosines input and the X' axis lying in the X, Y plane in the
  global (X,Y,Z) coordinate system

  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]

  OUTPUT:
        rot=     Coordinate transform matrix [3x3] [X' Y' Z']= [rot]*[X Y Z]

  CAUTION: input of dir_cos=[0,0,1] is "gimbal lock" condition and the first
           transform angle (alpha) cannot be determined - rot set to eye(3)

 Jim Leuer 1-13-97; Ref: Korn&Korn 1968 & Escibal'65 Pg 77

Dependencies