function optics_prism
close all
figure('position',[78 276 792 402]);
xp=[-0.2,0.2,0];yp=[0.2,0.2,0.5];B=pi/14;
ZZ=[xp;yp]'*[cos(B),sin(B);-sin(B),cos(B)];
fill(ZZ(:,1),ZZ(:,2),[0.2,0.4,0.6]);
axis([-1,1,0,1]);hold on;set(gca,'color','k');
t=0;A=pi/8;set(gcf,'doublebuffer','on');
x=[-1,-1];y=[0,0];
H=plot(x,y,'w','linewidth',6);
while t<0.8;
pause(0.1);
t=t+0.1;
x(2)=-1+t*cos(A);
y(2)=t*sin(A);
set(H,'xdata',x,'ydata',y);
end
x1=[x(2),x(2)];y1=[y(2),y(2)];H1=plot(x1,y1,'r');
H2=plot(x1,y1,'color',[1,1,0]);x2=x1;y2=y1;
H3=plot(x1,y1,'y');x3=x1;y3=y1;
H4=plot(x1,y1,'g');x4=x1;y4=y1;
H5=plot(x1,y1,'color',[0,1,1]);x5=x1;y5=y1;
H6=plot(x1,y1,'b');x6=x1;y6=y1;
H7=plot(x1,y1,'color',[1,0,1]);x7=x1;y7=y1;
t=0;
C=linspace(pi/16,0,7);
s=linspace(1,1.2,7);
while t<0.165;
pause(0.1);
t=t+0.01;
x1(2)=x(2)+t*cos(C(1))*s(1);y1(2)=y(2)+t*sin(C(1))*s(1);
x2(2)=x(2)+t*cos(C(2))*s(2);y2(2)=y(2)+t*sin(C(2))*s(2);
x3(2)=x(2)+t*cos(C(3))*s(3);y3(2)=y(2)+t*sin(C(3))*s(3);
x4(2)=x(2)+t*cos(C(4))*s(4);y4(2)=y(2)+t*sin(C(4))*s(4);
x5(2)=x(2)+t*cos(C(5))*s(5);y5(2)=y(2)+t*sin(C(5))*s(5);
x6(2)=x(2)+t*cos(C(6))*s(6);y6(2)=y(2)+t*sin(C(6))*s(6);
x7(2)=x(2)+t*cos(C(7))*s(7);y7(2)=y(2)+t*sin(C(7))*s(7);
set(H1,'xdata',x1,'ydata',y1);
set(H2,'xdata',x2,'ydata',y2);
set(H3,'xdata',x3,'ydata',y3);
set(H4,'xdata',x4,'ydata',y4);
set(H5,'xdata',x5,'ydata',y5);
set(H6,'xdata',x6,'ydata',y6);
set(H7,'xdata',x7,'ydata',y7);
end
C=linspace(0,-pi/8,7);
x1(1)=[];y1(1)=[];
x2(1)=[];y2(1)=[];
x3(1)=[];y3(1)=[];
x4(1)=[];y4(1)=[];
x5(1)=[];y5(1)=[];
x6(1)=[];y6(1)=[];
x7(1)=[];y7(1)=[];
K1=get(H1,'color');
K2=get(H2,'color');
K3=get(H3,'color');
K4=get(H4,'color');
K5=get(H5,'color');
K6=get(H6,'color');
K7=get(H7,'color');
L=2:3:400;n=1;
while t<0.5;
pause(0.1);
t=t+0.01;n=n+1;
plot([x1,x1+t*cos(C(1))],[y1,y1+t*sin(C(1))],...
'color',K1,'linewidth',L(n));
plot([x2,x2+t*cos(C(2))],[y2,y2+t*sin(C(2))],...
'color',K2,'linewidth',L(n));
plot([x3,x3+t*cos(C(3))],[y3,y3+t*sin(C(3))],...
'color',K3,'linewidth',L(n));
plot([x4,x4+t*cos(C(4))],[y4,y4+t*sin(C(4))],...
'color',K4,'linewidth',L(n));
plot([x5,x5+t*cos(C(5))],[y5,y5+t*sin(C(5))],...
'color',K5,'linewidth',L(n));
plot([x6,x6+t*cos(C(6))],[y6,y6+t*sin(C(6))],...
'color',K6,'linewidth',L(n));
plot([x7,x7+t*cos(C(7))],[y7,y7+t*sin(C(7))],...
'color',K7,'linewidth',L(n));
x1=x1+t*cos(C(1));y1=y1+t*sin(C(1));
x2=x2+t*cos(C(2));y2=y2+t*sin(C(2));
x3=x3+t*cos(C(3));y3=y3+t*sin(C(3));
x4=x4+t*cos(C(4));y4=y4+t*sin(C(4));
x5=x5+t*cos(C(5));y5=y5+t*sin(C(5));
x6=x6+t*cos(C(6));y6=y6+t*sin(C(6));
x7=x7+t*cos(C(7));y7=y7+t*sin(C(7));
end
end