% --- start of displayed preamble in the book --- % --- end of displayed preamble in the book --- def EllipseLabelsAndPoints= pickup pencircle scaled 3pt; for i=O,A,B,C,D,E,F,G,K, M1,M2,N1,N2,P1,P2,P3,P4: draw i; endfor; pickup pencircle scaled .5; label.llft(btex \$D\$ etex,D); label.urt(btex \$C\$ etex,C); label.bot(btex \$A\$ etex,A); label.top(btex \$B\$ etex,B); label.lrt(btex \$M_1\$ etex,M1); label.ulft(btex \$M_2\$ etex,M2); label.llft(btex \$N_1\$ etex,N1+1mm*up); label.rt(btex \$N_2\$ etex,N2+1mm*up); label.bot(btex \$F\$ etex,F+1mm*left); label.ulft(btex \$E\$ etex,E); label.rt(btex \$K\$ etex,K); label.llft(btex \$G\$ etex,G); label.llft(btex \$P_1\$ etex,P1); label.ulft(btex \$P_2\$ etex,P2); label.urt(btex \$P_3\$ etex,P3); label.lrt(btex \$P_4\$ etex,P4); enddef; defaultfont:="ptmr8r"; warningcheck:=0; beginfig(1) pair O,A,B,C,D,E,F,G,K,M[],N[],P[];path parallelogram,X; O=origin;B-O=O-A=3cm*dir(120);D-O=O-C=4cm*dir(180); P1=A+D-O;P2=B+D-O;P3=B+C-O;P4=A+C-O; draw A--B dashed evenly withcolor blue; draw C--D dashed evenly withcolor blue; parallelogram=P1--P2--P3--P4--cycle; draw parallelogram; E-D=arclength(O--B)*(unitvector(B-A) rotated -90); draw D--E;draw O--E;F=.5[O,E]; X=fullcircle scaled arclength(O--E) shifted F; draw X; G=(F--D) intersectionpoint X;K=(F--(F+(F-D))) intersectionpoint X; draw D--K; N1-O=O-N2=arclength(D--G)*unitvector(O-K); M1-O=O-M2=arclength(D--K)*unitvector(O-G); draw N1--N2 dashed evenly;draw M1--M2 dashed evenly; a:=arclength(M1--O);b:=arclength(N1--O);an:=angle(M1-O); draw fullcircle xscaled 2a yscaled 2b rotated an shifted O withcolor red; draw E--(E+(E-D)) dashed evenly; EllipseLabelsAndPoints; % not shown endfig; end;