function [T]=rot3d_pre(theta,axis_key)
%
%rot3d_pre(theta,axis_key)
% rotate by theta about one of x,y, or z axes
%inputs: theta
%        axis_key (=1 for x, 2 for y, 3 for z axis)

% filename must be "rot3d_pre.m"
% general syntax
% function [T,R]=someotherfunction(inputvariables)

if(axis_key==1)
 T=[   1         0          0       0;
        0   cos(theta) -sin(theta)  0;
        0   sin(theta)  cos(theta)  0;
        0         0          0      1];      
end

if(axis_key==2)
 T=[cos(theta)   0  sin(theta)   0;
      0          1      0        0;
   -sin(theta)   0  cos(theta)   0;
        0        0         0     1]; 
end

if(axis_key==3)  
 T=[ cos(theta)  -sin(theta) 0  0;
     sin(theta)   cos(theta) 0  0;
          0         0        1  0 
          0         0        0  1]; 
  end   
 