LiveGraphics3D Example:
Geometric Constructions (Simson Line)

The Simson Line
 This example demonstrates the construction of the Simson line, which goes through the feet of the perpendiculars from a point on the circumcircle to the sides of a triangle. You may drag the vertices of the triangle or the point on the circumcircle.

Implementation

Here is how to create this example within Mathematica:

```independentVariables = {x -> 1.5, y -> 0.9, ax -> 0., ay -> 0.,
bx -> 1., by -> .7, cx -> 1.6, cy -> -0.9};

Circumcircle[{{x1_, y1_}, {x2_, y2_}, {x3_, y3_}}] :=
Module[{a = Det[{{x1, y1, 1}, {x2, y2, 1}, {x3, y3, 1}}],
d = -1/2 Det[{{x1^2 + y1^2, y1, 1}, {x2^2 + y2^2, y2, 1},
{x3^2 + y3^2, y3, 1}}],
f = 1/2 Det[{{x1^2 + y1^2, x1, 1}, {x2^2 + y2^2, x2, 1},
{x3^2 + y3^2, x3, 1}}],
g = -Det[{{x1^2 + y1^2, x1, y1}, {x2^2 + y2^2, x2, y2},
{x3^2 + y3^2, x3, y3}}]},
{{-d/a, -f/a}, Sqrt[(f^2 + d^2)/a^2 - g/a]}]

projectToLine[x_, a_, b_] :=
Module[{}, a + (b - a)*(x - a).(b - a)/((b - a).(b - a))];

pc = projectToLine[{px, py, 0}, {ax, ay, 0}, {bx, by, 0}];

pa = projectToLine[{px, py, 0}, {bx, by, 0}, {cx, cy, 0}];

pb = projectToLine[{px, py, 0}, {cx, cy, 0}, {ax, ay, 0}];

circ = Circumcircle[{{ax, ay}, {bx, by}, {cx, cy}}];

dependentVariables = {ccx -> circ[[1, 1]], ccy -> circ[[1, 2]],
ccr -> circ[[2]],
angle -> ArcTan[x - ccx, y - ccy],
px -> ccx + ccr*Cos[angle], py -> ccy + ccr*Sin[angle],
x -> px, y -> py,
pax -> pa[[1]], pay -> pa[[2]],
pbx -> pb[[1]], pby -> pb[[2]],
pcx -> pc[[1]], pcy -> pc[[2]],
lab -> Sqrt[({pax, pay, 0} - {pbx, pby, 0}).
({pax, pay, 0} - {pbx, pby, 0})],
lac -> Sqrt[({pax, pay, 0} - {pcx, pcy, 0}).
({pax, pay, 0} - {pcx, pcy, 0})],
lcb -> Sqrt[({pcx, pcy, 0} - {pbx, pby, 0}).
({pcx, pcy, 0} - {pbx, pby, 0})],
sax -> If[lac > lcb, If[lac > lab, pax, pax], If[lcb > lab, pcx, pax]],
say -> If[lac > lcb, If[lac > lab, pay, pay], If[lcb > lab, pcy, pay]],
sbx -> If[lac > lcb, If[lac > lab, pcx, pbx], If[lcb > lab, pbx, pbx]],
sby -> If[lac > lcb, If[lac > lab, pcy, pby], If[lcb > lab, pby, pby]]};

scene = Graphics3D[{{Thickness[0.01],
Line[{{ax, ay, 0}, {bx, by, 0}, {cx, cy, 0}, {ax, ay, 0}}]},
PointSize[.04], Point[{x, y, 0}], Point[{ax, ay, 0}],
Point[{bx, by, 0}], Point[{cx, cy, 0}], PointSize[0.03],
Point[{pax, pay, 0}], Point[{pbx, pby, 0}],
Point[{pcx, pcy, 0}], Line[{{px, py, 0}, {pax, pay, 0}}],
Line[{{px, py, 0}, {pbx, pby, 0}}],
Line[{{px, py, 0}, {pcx, pcy, 0}}],
Line[{{sax + 2*(sax - sbx), say + 2*(say - sby), 0},
{sbx + 2*(sbx - sax), sby + 2*(sby - say), 0}}],
Line[Table[{ccx, ccy, 0} + ccr*{Cos[phi], Sin[phi], 0},
{phi, 0., 2 Pi + 0.00001, 2 Pi/64.}]]},
Boxed -> False, ViewPoint -> {0, 0, 4}, ViewVertical -> {0, 1, 0},
PlotRange -> {{-0.5, 2.0}, {-1.5, 1}, {-1, 1}}];

Show[scene //. Join[independentVariables, dependentVariables]];
```

LiveGraphics3D has to be called with the InputForms of the scene and the replacement rules.

Note that the independent variables x and y are also modified by the replacement rules for dependent variables! The result is a projection of the user input onto the circle. In fact, whenever this construction (modification of independent variables by rules for dependent variables) is employed, you should make sure that the modification is a projection, otherwise there will be strange effects!

Martin Kraus, April 16, 2021