%This function is called by afga.m
%It rotates a vector r 
%by an angle theta about the axis a.
%r and a must be unit R^3 vectors.
function r_new = afga_rot(a, theta, r)
r_new = a*(a'*r)+ cross(a, r)*sin(theta) +(r - (a'*r)*a)*cos(theta);
