Butterfly Theorem, Oliver Knill, MathE320, 2012

Butterfly[s_]:=Module[{},LineIntersect[A1_,A2_,B1_,B2_]:=Module[{ss,tt},A1+(tt/.Solve[A1+tt (A2-A1)==B1+ss (B2-B1),{tt,ss}][[1]]) (A2-A1)];
IntersectWithCircle[{Q1_,Q2_},{M1_,M2_}]:=Module[{t},t=(-(M1*Q1)+Q1^2-M2*Q2+Q2^2+Sqrt[M1^2+M2^2-2*M1*Q1+Q1^2-M2^2*Q1^2-2*M2*Q2+2*M1*M2*Q1*Q2+Q2^2-M1^2*Q2^2])/(M1^2+M2^2-2*M1*Q1+Q1^2-2*M2*Q2+Q2^2);{Q1,Q2}+t{M1-Q1,M2-Q2}];
(*Q={Q1,Q2};M={M1,M2};t/.Solve[(Q+t (M-Q)).(Q+t (M-Q))==1,t][[2]]*)phia=0.4+0.4 Sin[s];phib=1.9+0.3 Sin[3 s];phic=2.4+0.2 Cos[2s];phid=-0.3+0.6 Sin[5s]+0.1 Sin[s];
A={Cos[phia],Sin[phia]};B={Cos[phib],Sin[phib]};M=(A+B)/2;S={Cos[phic],Sin[phic]};Q={Cos[phid],Sin[phid]};
P=IntersectWithCircle[Q,M];R=IntersectWithCircle[S,M];r=0.03;
U=LineIntersect[A,B,P,S];V=LineIntersect[A,B,R,Q];
S1=Graphics[{Blue,Thickness[r/10],Circle[{0,0},1]}];
S2=Graphics[{Red,Disk[A,r]}];
S3=Graphics[{Red,Disk[B,r]}];
S4=Graphics[{Orange,Disk[M,r]}];
S5=Graphics[{Green,Disk[S,r]}];
S6=Graphics[{Green,Disk[Q,r]}];
S7=Graphics[{Purple,Disk[P,r]}];
S8=Graphics[{Purple,Disk[R,r]}];
S9=Graphics[{Yellow,Polygon[{S,P,Q,R,S}]}];
S10=Graphics[{Red,Thickness[r/10],Line[{A,B}]}];
S11=Graphics[{RGBColor[0.5,0.5,1],Disk[U,r]}];
S12=Graphics[{RGBColor[0.5,0.5,1],Disk[V,r]}];
SS=Show[{S1,S9,S2,S3,S9,S4,S5,S6,S7,S8,S10,S11,S12},AspectRatio->1,PlotRange->{{-1.2,1.2},{-1.2,1.2}}]];
Manipulate[Butterfly[s],{s,0,1}]