Closest Pair of Points

A visualization of a divide-and-conquer algorithm for finding the closest pair of points in the plane.

Instructions: Click on the canvas to create points manually. Use the buttons to perform various actions: generate a random set of 10 points, run the algorithm, or clear the canvas. Alternatively, press "space", "enter" or "delete".

Annotations: The red dashed lines delineate the boundaries between the subproblems, within which the closest pairs of points are connected by a green line. The subproblem currently under examination is highlighted in teal. When comparing results from the left and right subproblems, they are highlighted in peach. During the merge step, the strip being considered is shown in lavender.

Next Steps: What would make the visualization more informative? Labels? Arrows? A few scenarios need to be handled interface-wise, such as pressing the buttons during an ongoing animation. In addition, it would be useful to introduce a feature to adjust the animation speed. Of course, some refactoring would be nice — the code is a bit of a hot mess.