function output = deflection(input,a1,a2,b,n1,n2); % DEFLECTION calculates the deflection caused by three planar surfaces that % are oriented in order at angles a1, b, and a2 wrt the vertical direction. % a1 and a2 are measured as positive for cw rotations and b is measured as % positive for ccw rotations. INPUT is the direction of the input beam % measured wrt the horizontal direction and OUTPUT is the direction of the % output beam meaured wrt the horizontal direction. % R. Victor Jones, Harvard University, 12-15-00 %=================================== % a1 = pi * a1/180; a2 = pi * a2/180; b = pi * b/180; input = pi * input/180; t1 = asin((1/n1)*sin(input+a1))-a1; t2 = asin((n1/n2)*sin(t1-b))+b; t3 = asin((n2)*sin(t2+a2))-a2; output = 180 * t3/pi;