summaryrefslogtreecommitdiff
path: root/info/examples/lgc2/4-4-1.mp
blob: 8746ab625c94fdb9edca59e434f60bb924278a05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
% --- start of displayed preamble in the book ---

% --- end of displayed preamble in the book ---

def NinepointsLabelsAndDots=
  pickup pencircle scaled 2pt;
  drawdot(A);drawdot(B);drawdot(C);
  drawdot(D);drawdot(E);drawdot(F);
  drawdot(G);drawdot(H);drawdot(I);
  drawdot(X);drawdot(J);drawdot(K);
  drawdot(L);drawdot(N);
  pickup pencircle scaled .5;
  label.lrt(btex $A$ etex,A);
  label.urt(btex $B$ etex,B);
  label.lft(btex $C$ etex,C);
  label.rt(btex $D$ etex,D);
  label.ulft(btex $E$ etex,E);
  label.llft(btex $F$ etex,F);
  label.ulft(btex $G$ etex,G);
  label.bot(btex $H$ etex,H);
  label.lrt(btex $I$ etex,I);
  label.urt(btex \strut$X$ etex,X);
  label.bot(btex $J$ etex,J);
  label.llft(btex \strut$K$ etex,K);
  label.urt(btex $L$ etex,L);
  label.lft(btex $N$ etex,N);
enddef;

defaultfont:="ptmr8r";
warningcheck:=0;
beginfig(1)
numeric u;u=1cm;
pair A,B,C,D,E,F,G,H,I,J,K,L,N,X;
A=origin;B-A=(0,5u);C-A=(-7u,u); % A,B,C
D-A=B-D;E-B=C-E;F-A=C-F; % middles D,E,F
% then, the three heights:
G=whatever[B,C]=whatever[A,A+((C-B) rotated 90)]; % G
H=whatever[A,C]=whatever[B,B+((C-A) rotated 90)]; % H
I=whatever[A,B]=whatever[C,C+((B-A) rotated 90)]; % I
% then, the orthocenter X
X=(A--G) intersectionpoint (C--I);
% and the middles J, K and L of AX, BX and CX
J=.5[A,X];K=.5[B,X];L=.5[C,X];
% the center of the nine points circle
N=whatever[.5[D,I],(.5[D,I]+((D-I) rotated 90))]
 =whatever[.5[D,H],(.5[D,H]+((D-H) rotated 90))];
% circle radius
r=arclength(I--N);
draw A--B--C--cycle;draw A--G;draw B--H;draw C--I;
draw fullcircle scaled 2r shifted N;
NinepointsLabelsAndDots;
endfig;
end;