A game inspired by the nice visualization of a problem from the 52nd International Mathematical Olympiad.
Let
S
be a finite set of at least two points in the plane. Assume that no three points ofS
are collinear. By a windmill we mean a process as follows. Start with a linel
going through a pointP ∈ S
. Rotatel
clockwise around the pivotP
until the line contains another pointQ
ofS
. The pointQ
now takes over as the new pivot. This process continues indefinitely, with the pivot always being a point fromS
.Show that for a suitable
P ∈ S
and a suitable starting linel
containingP
, the resulting windmill will visit each point ofS
as a pivot infinitely often.
cargo run
Key | Action |
---|---|
R | reset |
U | increase speed |
D | decrease speed |
Esc | quit |
There are already a handful of open source implementations available in different languages and frameworks including the one from the visualization video. They're mostly implemented in a way that an angle between the line and the point is calculated and then compared to 0
or PI
to detect new pivot. This implementation calculates point orientation in regards to the line and detects new pivot when orientation changes.