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;