|
|
Description
This applet demonstrates the working of a plane-sweep algorithm
in finding the closest pair among a set of points.
A
vertical line sweeps the plane from the first to the last point using an event queue that containts all points sorted by x-coordinate. The sweep line algorithm uses a status structure that contains a set of candidate points used in the computation. Ths solution set contains the indices of the closest pair identified so far, and also the distance 'd' between them. At any position of the sweep line, a window of width 'd' and height '2d' is used to select points from the status structure for the computation of distance from the current point.Points at a horizontal distance greater than 'd' from the current point are removed from the status structure. The closest pair is shown with red colour.
Computational Geometry
Java Applets Centre