A = p 4 B = p 5 CP = E[ p 7, p 2, p 3, p 6, p 1, p 8 ] S[p 4, p 5 ] d min = d 45 Plane Sweep Algorithm for Closest Pair Problem E=Event QueueS=Status Queue A,B = Current closest pair CP = Current point d min = Current minimum distance (distance between point A and B) d ij = distance between p i and p j p4p4 p1p1 p6p6 p2p2 p7p7 p8p8 p3p3 p5p5
Previous A = p 4 B = p 5 CP = E[ p 7, p 2, p 3, p 6, p 1, p 8 ] S[ p 4, p 5 ] d min = d 45 p4p4 p1p1 p6p6 p2p2 p7p7 p8p8 p3p3 p5p5 New A = p 4 B = p 5 CP = p 7 E[ p 7, p 2, p 3, p 6, p 1, p 8 ] S[ p 4, p 5, p 7 ] d min <= min (d min, d 57 ) = d 45 d 45
Previous A = p 4 B = p 5 CP = p 7 E[ p 2, p 3, p 6, p 1, p 8 ] S[ p 5, p 7 ] d min = d 45 p4p4 p1p1 p6p6 p2p2 p7p7 p8p8 p3p3 p5p5 New A = p 2 B = p 7 CP = p 2 E[ p 2, p 3, p 6, p 1, p 8 ] S[ p 5, p 7, p 2 ] d min <= min (d min, d 25, d 27 ) = d 27 d 45
Previous A = p 2 B = p 7 CP = p 2 E[ p 3, p 6, p 1, p 8 ] S[ p 5, p 7, p 2 ] d min = d 27 p4p4 p1p1 p6p6 p2p2 p7p7 p8p8 p3p3 p5p5 New A = p 2 B = p 7 CP = p 3 E[ p 3, p 6, p 1, p 8 ] S[ p 5, p 7, p 2, p 3 ] d min <= d 27 d 27
Previous A = p 2 B = p 7 CP = p 3 E[ p 6, p 1, p 8 ] S[p 3 ] d min <= d 27 p4p4 p1p1 p6p6 p2p2 p7p7 p8p8 p3p3 p5p5 New A = p 3 B = p 6 CP = p 6 E[ p 6, p 1, p 8 ] S[ p 3, p 6 ] d min <= min (d min, d 36 ) = d 36 d 27
Previous A = p 3 B = p 6 CP = p 6 E[ p 1, p 8 ] S[p 3, p 6 ] d min <= d 36 p4p4 p1p1 p6p6 p2p2 p7p7 p8p8 p3p3 p5p5 New A = p 3 B = p 6 CP = p 1 E[ p 1, p 8 ] S[ p 3, p 6, p 1 ] d min <= d 36 d 36
Previous A = p 3 B = p 6 CP = p 1 E[ p 8 ] S[ p 1 ] d min <= d 36 p4p4 p1p1 p6p6 p2p2 p7p7 p8p8 p3p3 p5p5 New A = p 3 B = p 6 CP = p 8 E[ p 8 ] S[ p 1, p 8 ] d min <= d 36 d 36 Event Queue Is Empty, therefore STOP