.geometry "version 0.31";
.l0; 
tr = .f.rpn(-0.010000);
v1 = .free(-0.95697, -0.265804, "A");
v2 = .free(-0.24307, 0.924027, "B");
v2a = .v.vtranslate(v2, 0.000000, tr, .in);
v3 = .free(0.915029, -0.265804, "C");
l1 = .l.vv(v1, v2, [.white, .blink2, .white]);
l2 = .l.vv(v2, v3, [.white, .blink2, .white]);
l3 = .l.vv(v3, v1, [.white, .blink2, 2 .blink, .white]);
l4 = .l.vlperp(v2, l3, .red, .longline);
l5 = .l.vlperp(v3, l1, .red, .longline);
l6 = .l.vlperp(v1, l2, .red, .longline);
v4 = .v.ll(l1, l5, .red, "F");
v5 = .v.ll(l2, l6, .red, "E");
v6 = .v.ll(l3, l4, .red, "G");
v7 = .v.ll(l6, l4, .red, "H");
v8 = .v.vvmid(v7, v1, .green, "Q");
v9 = .v.vvmid(v7, v2, .green, "S");
v10 = .v.vvmid(v7, v3, .green, "R");
v11 = .v.vvmid(v1, v2, .yellow, "C'");
v11a = .v.vtranslate(v11, 0.000000, tr, .in);
v12 = .v.vvmid(v2, v3, .yellow, "A'");
v12a = .v.vtranslate(v12, 0.000000, tr, .in);
v13 = .v.vvmid(v3, v1, .yellow, "B'");
c1 = .c.vvv(v10, v9, v8, .magenta, .l0);
bl1 = .l.vv(v2a, v11a, [.in, .blink, .in]);
bl3 = .l.vv(v12a, v2a, [.in, .blink, .in]);
cc1 = .c.vvv(v10, v9, v8, [6 .in, .blink, .magenta]);
.text("The Nine Point Circle:
In \triangleABC, the feet of the altitudes (E,F,G),
the midpoints of the sides (A', B', and C'),
and the midpoints Q, R, and S between the
orthocenter and A, B, and C all lie on
the same circle.  Move points A, B, and C.", .l0);
l7 = .l.vv(v11, v12, [.in, 3 .blink, .blue, .blink, .blue]);
l8 = .l.vv(v8, v10, [3 .in, .blink, .blue, .blink, .blue]);
l9 = .l.vv(v12, v10, [4 .in, 2 .blink, .blue]);
l10 = .l.vv(v11, v8, [4 .in, 2 .blink, .blue]);
.text("\triangleABC \similar \triangle C'BA' by SAS similarity since
2 BC' = BA, 2 BA' = BC and \angleB is
congruent to itself.", .l1);
.text("Since the triangles are similar,
\angleBC'A' \congruent \angle BAC, so
C'A' is parallel to AC", .l2);
.text("By similar reasoning on \triangleAHC,
QR is also parallel to AC.
Thus QR is parallel to C'A'", .l3);
.text("The same argument on \triangleBHA and
\triangleBHC shows that C'Q and A'R are
parallel to BH and hence parallel to each other.", .l4);
.text("Since BH \perp AC, A'R and C'Q are
perpendicular to C'A' and QR, so
A'C'QR is a rectangle.", .l5);
l11 = .l.vv(v8, v12, [6 .in, .blink, .blue]);
l12 = .l.vv(v11, v10, [6 .in, .blink, .blue]);
v14 = .v.ll(l12, l11, [6 .in, .blink, .blue], .plus, "N");
.text("The point N at the center of the rectangle A'C'QR is thus equidistant
from A', C', Q, and R, so all those points lie on a circle
centered at N.  Since the construction of the rectangle could
have been made parallel to AB or BC in a similar way, all the green
and yellow points are equidistant from N and lie on the same circle.", .l6);
.text("Finally, every foot of an altitude lies on the same circle.  For
example, the point E in the triangle A'E'Q is a right angle, and A'Q
is a diameter of the circle.  Since E is a right angle, it must lie
on the circle with diameter A'Q.  QED.", .l7);
l13 = .l.vv(v6, v2, .red, .l0, .ray12);
.text("Press 'Next' to continue ...", .red, .tol6);
l14 = .l.vv(v2, v7, .blink, .l4);
l15 = .l.vv(v8, v5, .blink, .l7);
l16 = .l.vv(v5, v12, .blink, .l7);
l17 = .l.vv(v8, v12, .blink, .l7);
ang1 = .a.vvv(v12, v11, v2, .blink1, .l2);
ang2 = .a.vvv(v3, v1, v2, .blink1, .l2);
ang3 = .a.vvv(v8, v5, v12, .blink1, .l7, .right);
