function [angle,vec] = quatrot(q1)
%  Compute the angle and axis of a rotation from a quaternion.
%  
%  $BEGIN
%  $HEADER quatrot
%
%  Compute the angle and axis of a rotation from a quaternion.
%
%  $HEADER REFERENCE
%  W. Bean, Operational Use of Quaternions
%  in the Description of Rigid Body Motion,
%  MSC Internal Note #69-FM-237, (1969)
%
%  $HEADER PROGRAMMER
%  John W. Craft, Jr.
%  University of Houston, (2005)
%
%  $HEADER VERSION
%  1.0.0
%
%  Example
%  [angle,rotation_vector] = quatrot(q1)
%
%  See Also quatmat quatmult
%  
%  $END
%


 angle = 2.0 * acos(q1(1));

 temp = [q1(2) q1(3) q1(4)];

 vec = -1.0 * temp ./ sin(angle/2.)

return

