% Initialize some useful variables to reflect the paper size, and whether to % use color. def simple_init = boolean usecolor; usecolor=true; % True if the shapes should be colored in numeric wd, ht; wd=210mm; ht=297mm; z0=(wd/2, ht/2); % Center of page. enddef; % The shape shown on page 0043 of Principia Discordia. % It has the caption: % "No two elements interlock % But all five do interlock" beginfig(1) simple_init; % The interlocking shapes. numeric radius; radius=93mm; % Radius of enclosing circle. numeric sradius; sradius=43.5/51*radius; numeric startang; startang=234; % For rotating the whole thing. numeric np; np=5; % number of points and number of levels deep. numeric ang; ang=360/np; % Angle between points. % A macro for finding the indices of the next and previous points from I. def find_relative_point_indices(expr i) = numeric ni, nni; ni=(i mod np)+1; nni=(ni mod np)+1; numeric ri, rri; ri=((i-2) mod np)+1; rri=((ri-2) mod np)+1; enddef; % Define the points of the inner and outer edges of the main pentagon. numeric k; k=10; for i=1 upto np: find_relative_point_indices(i); % End points of outer and inner edges of 1st level bit. z[k+i]=z0+radius*dir(startang+(i-1)*ang); z[k+np+i]=z0+sradius*dir(startang+(i-1)*ang); % End points of outer and inner edges of 1st upward diagonal bit. z[k+2np+i]=1/2[z[k+i],z[k+ni]]; z[k+3np+i]=1/2[z[k+np+i],z[k+np+ni]]; % End points of outer and inner edges of 2nd level bit. z[k+6np+i]=1/2[z[k+2np+ri],z[k+2np+i]]; z[k+7np+i]=1/2[z[k+3np+ri],z[k+3np+i]]; % End points of outer and inner edges of 2nd upward diagonal bit. z[k+8np+i]=1/2[z[k+6np+i],z[k+6np+ni]]; z[k+9np+i]=1/2[z[k+7np+i],z[k+7np+ni]]; % End points of outer and inner edges of 3rd level bit. z[k+11np+i]=1/2[z[k+8np+ri],z[k+8np+i]]; z[k+12np+i]=1/2[z[k+9np+ri],z[k+9np+i]]; endfor for i=1 upto np: find_relative_point_indices(i); % Point where outer edge of 1st upward diagonal bit is hidden. z[k+4np+i]=(z[k+2np+i]--z[k+2np+ni]) intersectionpoint (z[k+np+ni]--z[k+np+nni]); % Point where inner edge of 1st level bit is hidden. z[k+5np+i]=(z[k+2np+i]--z[k+2np+ni]) intersectionpoint (z[k+np+i]--z[k+np+ni]); % Point where inner edge of 1st upward diagonal bit is hidden z[k+13np+i]=(z[k+3np+i]--z[k+3np+ni]) intersectionpoint (z[k+6np+i]--z[k+6np+ni]); % Point where outer edge of 2nd level bit is hidden. z[k+14np+i]=(z[k+6np+i]--z[k+6np+ni]) intersectionpoint (z[k+3np+ri]--z[k+3np+i]); % Point where inner edge of 2nd level bit is hidden. z[k+15np+i]=(z[k+7np+i]--z[k+7np+ni]) intersectionpoint (z[k+8np+i]--z[k+8np+ni]); % Point where outer edge of 2nd upward diagonal is hidden. z[k+10np+i]=(z[k+8np+i]--z[k+8np+ni]) intersectionpoint (z[k+7np+ni]--z[k+7np+nni]); % Point where inner edge of 2nd upward diagonal bit is hidden z[k+16np+i]=(z[k+9np+i]--z[k+9np+ni]) intersectionpoint (z[k+11np+i]--z[k+11np+ni]); % Point where outer edge of 3rd level bit is hidden. z[k+17np+i]=(z[k+11np+i]--z[k+11np+ni]) intersectionpoint (z[k+9np+ri]--z[k+9np+i]); endfor; % Fill in the shapes of the interlocking bits if color is turned on. if usecolor: for i=1 upto np: find_relative_point_indices(i); color fillcol; fillcol= if i=1: (1, 0.7, 1); elseif i=2: (1, 0.8, 0.8); elseif i=3: (0.8, 0.8, 1); elseif i=4: (0.7, 1, 1); elseif i=5: (0.8, 1, 0.8); fi % These bits are arranged anti-clockwise round each loop. fill z[k+i]--z[k+2np+i]--z[k+6np+ni]--z[k+13np+i]--z[k+3np+i]-- z[k+np+i]--z[k+5np+ri]--z[k+2np+ri]--cycle withcolor fillcol; fill z[k+7np+ni]--z[k+9np+ni]--z[k+16np+ni]--z[k+11np+nni]--z[k+8np+ni]-- z[k+14np+ni]--cycle withcolor fillcol; fill z[k+12np+nni]--z[k+12np+rri]--z[k+9np+rri]--z[k+10np+nni]-- z[k+11np+rri]--z[k+17np+nni]--cycle withcolor fillcol; fill z[k+8np+rri]--z[k+6np+ri]--z[k+4np+rri]--z[k+3np+ri]-- z[k+7np+ri]--z[k+15np+rri]--cycle withcolor fillcol; endfor fi % Draw the lines of the interlocking thingies. pickup pencircle scaled 1.7pt; for i=1 upto np: find_relative_point_indices(i); color curcol; curcol=black; %color curcol; curcol= if i=1: (1,0,1) else: black fi; def drw(expr foo) = draw foo withcolor curcol enddef; % 1st level bit. drw (z[k+i]--z[k+ni]); drw (z[k+np+i]--z[k+3np+i]); drw (z[k+5np+i]--z[k+np+ni]); % 1st upward diagonal bit. drw (z[k+2np+i]--z[k+4np+i]); drw (z[k+3np+i]--z[k+13np+i]); drw (z[k+7np+ni]--z[k+3np+ni]); % 2nd level bit. drw (z[k+7np+i]--z[k+9np+i]); drw (z[k+14np+i]--z[k+6np+ni]); drw (z[k+15np+i]--z[k+7np+ni]); % 2nd upward diagonal bit. drw (z[k+8np+i]--z[k+10np+i]); drw (z[k+9np+i]--z[k+16np+i]); drw (z[k+12np+ni]--z[k+9np+ni]); % 3rd level bit. drw (z[k+17np+i]--z[k+11np+ni]); drw (z[k+12np+i]--z[k+12np+ni]); endfor % The horns thing in the middle. numeric oradius, iradius; oradius = 1/5*radius; % Radius of outer edge of circle. iradius = 9/10*oradius; z9=(0.65*oradius, 0.35*oradius); %pickup pencircle scaled 0.7pt; numeric ang; ang=-35; % Angle of horn points. % Outer circle. path co; co=fullcircle scaled 2oradius shifted z0; % Inner circle, only parts of which will be drawn. path cl, cr; cl=halfcircle rotated 90 scaled 2iradius shifted z0; cr=halfcircle rotated -90 scaled 2iradius shifted z0; path htl, htr, hbl, hbr; path hil, hir, hotl, hotr, hobl, hobr; % Inside of right horn. hir=z0+(x9,y9){dir (0.5ang+180)}..z0+(0.1*oradius,0).. {dir (-0.5ang)}z0+(x9,-y9); % Outside of right horn, top. hotr=z0+(x9,y9){dir (ang+180)}..z0+(0.08*oradius,0.3*oradius); htr=z0+(0.08*oradius,oradius)--z0+(0.08*oradius,0.3*oradius); % Outside of right horn, bottom. hobr=z0+(x9,-y9){dir (-ang+180)}..z0+(0.08*oradius,-0.3*oradius); hbr=z0+(0.08*oradius,-oradius)--z0+(0.08*oradius,-0.3*oradius); % Inside of left horn. hil=z0+(-x9,y9){dir (-0.5ang)}..z0+(-0.1*oradius,0).. {dir (0.5ang+180)}z0+(-x9,-y9); % Outside of left horn, top. hotl=z0+(-x9,y9){dir (-ang)}..z0+(-0.08*oradius,0.3*oradius); htl=z0+(-0.08*oradius,oradius)--z0+(-0.08*oradius,0.3*oradius); % Outside of left horn, bottom. hobl=z0+(-x9,-y9){dir ang}..z0+(-0.08*oradius,-0.3*oradius); hbl=z0+(-0.08*oradius,-oradius)--z0+(-0.08*oradius,-0.3*oradius); % Connect together the inner circle and the vertical lines. path innerl, innerr; innerl=reverse hobl--reverse hil--hotl--reverse (htl cutbefore cl)-- reverse (reverse (cl cutbefore htl) cutbefore hbl)--cycle; innerr=reverse hotr--hir--hobr--reverse (hbr cutbefore cr)-- reverse (reverse (cr cutbefore hbr) cutbefore htr)--cycle; % All the (optional) filling and drawing. if usecolor: fill co withcolor (1, 1, 0.7); fill innerl withcolor white; fill innerr withcolor white; fi draw co; draw innerl; draw innerr; endfig; % Something. beginfig(2) simple_init % Colors. color femcol, tubecol; femcol=(0.8,0.6,1); tubecol=green;%(0.8,0.6,1); pickup pencircle scaled 3pt; path crescent, crescenti, crescento; crescento=fullcircle scaled (wd/3) shifted z0; crescenti=z0+(0,wd/17)..z0+(-wd/10,-wd/23)..z0+(0,-wd/5).. z0+(wd/10,-wd/23)..cycle; crescent=(crescento cutbefore (crescenti cutbefore (z0--(x0,y0-ht))))-- reverse (reverse crescento cutbefore (crescenti cutafter (z0--(x0,y0-ht))))-- reverse (crescenti cutafter (crescento cutafter (z0--(x0,y0-ht))))-- reverse (crescenti cutbefore (crescento cutbefore (z0--(x0,y0-ht))))-- cycle; def wobbly_thing (expr ang, len, size, waves) = % WAVES should always be odd. path circ; pair pcirc; pcirc=z0+(len*dir (90+ang)); circ=fullcircle xscaled size yscaled (13/17*size) rotated ang shifted pcirc; % Find lines inside the uterus and blobs facing each other, and construct % parallel lines between them for making the waves from. pair pcsl, pcsr, pcel, pcer; pcsl=(-1/2*13/17*wd/13, 0) rotated ang shifted z0+(wd/6.6*dir (90+ang)); pcsr=(1/2*13/17*wd/13, 0) rotated ang shifted z0+(wd/6.6*dir (90+ang)); pcel=(-1/2*13/17*size, 0) rotated ang shifted pcirc; pcer=(1/2*13/17*size, 0) rotated ang shifted pcirc; path lnol, lnor, lnil, lnir; lnol=pcsl--pcel; lnor=pcsr--pcer; lnil=4/5[pcsl,pcsr]--4/5[pcel,pcer]; lnir=4/5[pcsr,pcsl]--4/5[pcer,pcel]; % draw lnol withcolor green; % draw lnil withcolor green; % draw lnir withcolor green; % draw lnor withcolor green; % The wavy tubes. path wavel, waver, wavewhole; wavel=z0.. for i=0 upto waves: if odd i: (point (i/waves) of lnol)..tension 1.7.. else: (point (i/waves) of lnir)..tension 1.7.. fi endfor pcirc; waver=z0.. for i=0 upto waves: if odd i: (point (i/waves) of lnor)..tension 1.7.. else: (point (i/waves) of lnil)..tension 1.7.. fi endfor pcirc; wavel := wavel cutbefore (pcsl--pcsr); waver := waver cutbefore (pcsl--pcsr); wavewhole=wavel--reverse waver--cycle; fill wavewhole withcolor tubecol; draw wavewhole; % Fill and outline the blobs at the end of the tubes. if usecolor: fill circ withcolor femcol; fi draw circ; % The wavy spikes on the blobs. numeric spikes; spikes=5; pair tip; tip=1/2[pcsl,pcsr]+1.5*(1/2[pcel,pcer]-1/2[pcsl,pcsr]); draw tip; for i=0 upto spikes-1: def spike_pos(expr pos) = (pos[pcel,pcer]--(pos[pcsl,pcsr]+2(pos[pcel,pcer]-pos[pcsl,pcsr]))) intersectionpoint circ; enddef; pair spol, spil, spir, spor; spol=spike_pos(i/(spikes-1)-0.06); spil=spike_pos(i/(spikes-1)-0.03); spir=spike_pos(i/(spikes-1)+0.03); spor=spike_pos(i/(spikes-1)+0.06); path spklnol, spklnil, spklnir, spklnil; numeric spike_waves; spike_waves=10; for j=0 upto spike_waves: pair p; p= if odd j: ((j/spike_waves)[spol,tip]); else: ((j/spike_waves)[spor,tip]); fi if j=0: spklnol=p; else: spklnol := spklnol..p; fi endfor pickup pencircle scaled 0.5pt; draw spklnol; % fill spklnol--reverse spklnil--cycle; % fill spklnor--reverse spklnir--cycle; endfor enddef; wobbly_thing(83, 2/6*wd, wd/13, 5); wobbly_thing(42.5, (2/6*ht+2/6*wd)/2, (wd/13+wd/7)/2, 7); wobbly_thing(0, 2/6*ht, wd/7, 9); wobbly_thing(-42.5, (2/6*ht+2/6*wd)/2, (wd/13+wd/7)/2, 7); wobbly_thing(-83, 2/6*wd, wd/13, 5); fill crescento withcolor white; if usecolor: fill crescent withcolor femcol; fi draw crescent; endfig; % Masks. beginfig(3) simple_init % Work out where the grid lines are. These go right to the edge of the page, % on either the side or the top and bottom, depending on the size of the % page, so the masks should leave a margin. BOXSZ is both the width and % height of each box. % Here are the points at the ends and intersections of the grid lines. % z10 z11 z12 % z7 z8 z9 % z4 z5 z6 % z1 z2 z3 numeric boxsz; if wd/2 <= ht/3: boxsz=wd/2; else: boxsz=ht/3; fi % Space out the grid evenly. x1+boxsz=x2; x2+boxsz=x3; x4=x1; x4+boxsz=x5; x5+boxsz=x6; x7=x4; x7+boxsz=x8; x8+boxsz=x9; x10=x7; x10+boxsz=x11; x11+boxsz=x12; y1+boxsz=y4; y4+boxsz=y7; y7+boxsz=y10; y2=y1; y2+boxsz=y5; y5+boxsz=y8; y8+boxsz=y11; y3=y2; y3+boxsz=y6; y6+boxsz=y9; y9+boxsz=y12; % Center the grid in the page on both axes. x1=wd-x3; y1=ht-y10; % Draw the grid lines, if the condition on the next line is changed to true. if true: draw z1--z3; draw z4--z6; draw z7--z9; draw z10--z12; draw z1--z10; draw z2--z11; draw z3--z12; fi % The green mask. path gr_o; gr_o=(1/3boxsz,1/3boxsz)..(2/3boxsz,1/3boxsz)..cycle; if usecolor: fill gr_o shifted z7 withcolor green; fi pickup pencircle scaled 2.3pt; draw gr_o shifted z7; endfig; end