\input mftmac
$\9geo.mf;  assumes gnuchars.mf has been loaded.\par
$\2{input}\hbox{\tt gnuchars};\ \9otherwise, add this\par
Make a special format: {\tt \obeywhitespace \medskip
inimf plain$\b$; input modes$\b$; input gnuchars$\b$; dump
mv plain.base /usr/TeX/lib/mf/bases/gmf.base
ln -s /usr/TeX/bin/virmf /usr/TeX/bin/gmf
gmf geo}
\BL
Now that we know how to embed characters in \mf, let's do a bit of
geometry.  At the beginning of his {\it Elements,} Euclid shows that
the local symmetry of space (ie the postulated constructibility of
circles) leads to the global property that lengths can be `moved.'
First some preliminaries:
\BL
$\5{screenstrokes};\ \2{path}p[];$\par
$\2{pair}A,B,C,D,E,F,G,H;$\par
\quad$\2{pickup}\5{pencircle}\6{scaled}.06\\{pt};$\par
\quad$\\{spen}=\\{savepen};$\par
\quad$\2{pickup}\5{pencircle}\6{scaled}.12\\{pt};$\par
\quad$\\{mpen}=\\{savepen};$\par
\BL
We want to:
\BL
$\\{put\_text}(\7"Given A, B, C, construct segment at C of length
AB",0,450,0,1);$\par
$\5{showit};\ \\{sscreen}(80\\{pt}\SH ,80\\{pt}\SH ,2\\{pt}\SH ,1);$\par
\BL
\font\geofont=geo
Recall that the {\tt gnuchars.mf} file defined {\tt
put\_text(<string>, <x-coord>, <y-coord>, <rotation:0, 90, 180,
or270>, <justification: 1,2,3 (left, center, right)>)}. I pick
convenient generic points and then shift for my specific screen:
\BL
$A:=(50,50);\ B:=(60,-5);\ C:=(170,60);$\par
$\\{currenttransform}:=\\{identity}\6{shifted}(90,20);$\par
$\2{pickup}\\{mpen};$\par
$\2{drawdot}A;\ \\{put\_text}(\7"A",\1{xpart}A,\1{ypart}A+10,0,2);\ %
\5{showit};$\par
$\2{drawdot}B;\ \\{put\_text}(\7"B",\1{xpart}B+4,\1{ypart}B,0,1);\ \5{showit};$%
\par
$\2{drawdot}C;\ \\{put\_text}(\7"C",\1{xpart}C,\1{ypart}C+12,0,2);\ %
\5{showit};$\par
$\2{draw}A\8{--}B;$\par
\BL
To begin, we make use of Euclid's first theorem to:
\BL
$\\{put\_text}(\7"1. Construct equilateral ACD and circle A(B)",0,420,0,1);$\par
$\5{showit};$\par
$\\{sscreen}(80\\{pt}\SH ,80\\{pt}\SH ,2\\{pt}\SH ,1);$\par
\BL
\vglue .2in\line{\hfil\hfil\geofont B\hfil}\vglue .2in
To do this, we need a `compass,' a way to, given a center and a
point on the circumference, define a circle. Often in defining \mf\
macros, parentheses are needed to make \mf\ parse the macro
correctly.  For example,
\BL
$\2{def}\\{gcircle}(\2{expr}\\{wa},\\{wb})=$\par
\quad\quad$\\{fullcircle}\6{scaled}(2\ast \1{length}(\\{wa}-\\{wb}))\6{shifted}%
\\{wa}\3{enddef};$\par
\BL
In Euclidean geometry, lines intersect in points; however, lines
weren't thought of as a potentially incomplete set of points. Hence,
\BL
$D:=\\{gcircle}(A,C)\6{intersectionpoint}\\{gcircle}(C,A);$\par
\BL
\noindent obviously exists. Moreover, {\tt AD=AC} as radii of {\tt
gcircle(A,C)}; similarly, {\tt AC=CD} so {\tt AD=CD} since things
equal to the same thing are the same.
\BL
To illustrate this construction, we need another macro to draw arcs
such as we would draw with a compass. Knowing where the intersection
is, we can make the arcs short. The {\tt garc} macro expands to a
three point curve.
\BL
$\2{def}\\{garc}(\2{expr}\\{wa},\\{wb},d)=$\par
\quad\quad$\\{wb}\1{rotatedaround}(\\{wa},d)\8{..}\\{wb}\8{..}\\{wb}%
\1{rotatedaround}(\\{wa},-d)\3{enddef};$\par
$\2{pickup}\\{spen};\ \2{draw}\\{garc}(A,D,5);\ \2{draw}\\{garc}(C,D,5);$\par
$\2{pickup}\\{mpen};\ \2{drawdot}D;$\par
$\\{put\_text}(\7"D",\1{xpart}D,\1{ypart}D+20,0,2);\ \5{showit};$\par
\BL
Our idea is to use {\tt gcircle(A,B)} to rotate {\tt AB} until we
can slide it up a line to {\tt D} and then down to {\tt C}. Such
sliding might change the length of the segment so instead we appeal
to properties of circles.
\BL
$\2{pickup}\\{spen};\ \2{draw}\\{gcircle}(A,B);$\par
$\\{put\_text}(\7"2. Extend DA to E on A(B) and construct D(E)",0,400,0,1);$\par
$\5{showit};$\par
$\\{sscreen}(80\\{pt}\SH ,80\\{pt}\SH ,2\\{pt}\SH ,1);$\par
\BL
\vglue .2in\line{\hfil\hfil\geofont C\hfil}\vglue .2in
\BL
Since we're using \mf\ to merely illustrate the abstract proof, it
is convenient to have another circle macro:
\BL
$\2{def}\\{grcircle}(\2{expr}\\{wa},r)=\\{fullcircle}\6{scaled}(2\ast r)%
\6{shifted}\\{wa}\3{enddef};$\par
\BL
$r:=\1{length}(A-D)+\1{length}(A-B);$\par
$p_{1}:=\\{grcircle}(D,r);$\par
$\2{draw}p_{1};$\par
\BL
The point {\tt E} is where {\tt A(B)} intersects {\tt p1}. However, due to
rounding errors, {\tt E} needs to be specified differently. We
instead make use of the fact that the direction in which a point on
a circle is traveling, the tangent, is perpendicular to a radius at
that point:
\BL
$F=(A-D)\6{rotated}90;$\par
$t:=\2{directiontime}F\2{of}p_{1};\ E=\2{point}t\2{of}p_{1};\ \2{drawdot}E;$\par
\BL
$\9show E; uncomment following for proof of rounding error.\par
$\9show p1 intersectionpoint gcircle(A,B);\par
\BL
$\\{put\_text}(\7"E",\1{xpart}E+8,\1{ypart}E-8,0,3);\ \5{showit};$\par
\BL
$\2{draw}D\8{--}E;\ \2{pickup}\\{mpen};\ \2{draw}A\8{--}E;$\par
$\\{put\_text}(\7"3. Extend DC to H on D(E), then CH is segment.",0,380,0,1);$%
\par
$\5{showit};$\par
$\\{sscreen}(80\\{pt}\SH ,80\\{pt}\SH ,2\\{pt}\SH ,1);$\par
\BL
\vglue .2in\line{\hfil\hfil\geofont D\hfil}\vglue .2in
$\9We repeat the above procedure for {\tt H}.\par
\BL
$G=(C-D)\6{rotated}90;$\par
$t:=\2{directiontime}G\2{of}p_{1};\ H=\2{point}t\2{of}p_{1};$\par
\BL
$\2{pickup}\\{spen};\ \2{draw}D\8{--}H;$\par
$\2{draw}\\{gcircle}(D,C);$\par
$\2{pickup}\\{mpen};\ \2{drawdot}H;$\par
$\\{put\_text}(\7"H",\1{xpart}H+5,\1{ypart}H,0,1);\ \5{showit};$\par
\BL
$\2{draw}C\8{--}H;$\par
$\\{sscreen}(80\\{pt}\SH ,80\\{pt}\SH ,2\\{pt}\SH ,1);$\par
\BL
\vglue .2in\line{\hfil\hfil\geofont E\hfil}\vglue .2in
\BL
As radii, DH=DE so, subtracting the equilateral's sides DC=AC, we
have CH=AE. Thus CH=AB and the construction is complete.
$\!\3{end};$\par
