% SMALLCIRCLE: plots A small circle on stereogram
function [x,y] = smallcircle(trend,phi)
rad = pi/180;
dip = linspace(0,pi,100); 
beta = atan(cos(dip) * tan(phi*rad));
plunge = atan( sin(beta).* tan(dip) );
theta = pi/2 - (beta + trend*rad);
R = tan(pi/4 - 0.5*plunge);
x = R .* cos(theta);
y = R .* sin(theta);
plot (x,y);
hold on;

