Innisar

Oooh look, I found this shiny rock.

This app is to visualize calculation of the minimum bounding circle of a set of points. It seems straightforward to calculate:

  • Pick the first three points and calculate the circumcircle of a triangle.
  • Add the next point.
  • If it’s outside of the current circumcircle, swap it with the closest point in the triangle.
  • Do this for the rest of the points.

The problem is when the test triangle is very skinny. The skinnier the triangle, the larger the circumcircle, trending to infinite size when the three points are collinear. If that happens, I just substitute a circle as wide as the farthest 2 points (the antipodes) and centered at the midpoint. This mostly works, but sometimes that circle doesn’t bound all the points.

Oy.

This app creates a new point set to test every 1/3 second. If the test for triangle skinniness fires, it pauses and draws a green circle showing the antipode method and a red circle showing the circumcircle of three points method. The initial triangle vertices are marked in red.