function ang=law_cos_ang(r2c,r2a,r2b,rab)
%
% use law of cosines to compute an angle in a triangle
%
% acos returns in range 0 to pi
%
temp = (r2c - r2a - r2b)/(-2.0*rab);
% check against numerical errors
if (temp <= -1.0) 
     ang = pi;
elseif (temp >= 1.0)
     ang = 0;
else
     ang = acos(temp);
end
