//mirror apparent size plots
//increasing phi = reflection moving upwards, increasing theta = reflection moving CCW from above
//msl=25; //[mm] mirror side length {15,20,25}
//msw=msl;msh=msl;
msw=150;//[mm] mirror width
msh=12;//[mm] mirror height
//for 1 to 3 mirrors at +-45 deg theta acceptance
//  window sizes are:
//    3.79x5.5 mm full or 3.79x6.9 with small triangle at bottom
//    5.28x7.4 mm full or 5.28x11 with triangle
//    6.77x9.4 mm full or 6.77x14.1 with triangle
//for 4 mirrors at +-45 deg theta acceptance
//    no windows at any mirror size (theta split)
//for 1 to 3 mirrors at +-54 deg theta acceptance
//  window sizes are:
//    1.0x5.5 mm full
//    1.6x7.3 mm full
//    2.2x9.3 mm full
//for mirrors at +-60 deg theta acceptance
//    no windows at any mirror size (theta split)
//for 4 mirrors at +-30 deg theta acceptance
//    7.5x4.2 mm full
//    6.8x5.8 mm full
//    8.6x7.3 mm full

mth=5; //mm mirror thickness
//pcl=sqrt((msl^2-mth^2)/12); //mm zero-torque centerline for mirror
//mcl=pcl+mth/2; //[mm] mirror reflective surface offset at center
//mcl=0;

//2D projection of mirror for a laser at theta=0 phi=phi_ls
phi_ls=0/180*%pi;//[rad] phi of laser position
phi=45/180*%pi;//[rad] phi of mirror normal
taa=87.7/180*%pi;//[rad] theta +- acceptance angle
lbw=2;lbh=4; //[mm] laser beam width and height

if(%t)
clf();
plot([-lbw,-lbw,lbw,lbw,-lbw]/2,[-lbh,lbh,lbh,-lbh,-lbh]/2,'r.');
end
if(%t)
mpts=[
mth/2,mth/2,mth/2,mth/2,mth/2;
-msw/2,-msw/2,msw/2,msw/2,-msw/2;
-msh/2,msh/2,msh/2,-msh/2,-msh/2];
prm=[cos(phi),0,-sin(phi);0,1,0;sin(phi),0,cos(phi)];//rotate mirror by phi about Y
mpts=prm*mpts;
//mpts(1,:)=mpts(1,:)+mcl;//+msl/2*sin(abs(phi));//offset mirror by tilt from regular section
mpts(3,:)=mpts(3,:)-mth/2*sqrt(2);//move mirror down so visual center is at Z=0
pt=[0,taa,-taa];//[rad]  theta
nn=size(pt,2);
for(i=1:nn)
theta=pt(1,i);
trm=[cos(theta),-sin(theta),0;sin(theta),cos(theta),0;0,0,1];
mptsr=trm*mpts;
prm=[cos(-phi_ls),0,-sin(-phi_ls);0,1,0;sin(-phi_ls),0,cos(-phi_ls)];
mptsr=prm*mptsr;
xp=mptsr(2,:);
yp=mptsr(3,:);
plot(xp,yp,'color',i);
end
isoview on;
end
