The complete solution
Finds the Voronoi diagram for n given points. n can be 0. Assumes no duplicates.
- for each point Pk, 1≤k≤n
- find the perpendicular bisectors Bm, 1≤m≤n
- add the screen edge "bisectors" Bm, n+1≤m≤n+4
- for each intersection point Ti,j of the bisectors, k+1≤i<n+4, i<j≤n+4
- if the line segment through Ti,j and Pk does not intersect any Bm,
k+1≤m≤n, m≠i,j
- add Ti,j to Pk's polygon
- if i≤n, add Ti,j to Pi's polygon
- if j≤n, add Ti,j to Pj's polygon
The incremental solution
Finds the Voronoi diagram after adding a new point. Differs only slightly, as marked,
from the complete solution.
- to add a new point Pk, n<-n+1, k=n
- find the perpendicular bisectors Bm, 1≤m≤n
- add the screen edge "bisectors" Bm, n+1≤m≤n+4
- for each point Pr, 1≤r<n
- remove each point from Pr's polygon that lies on the opposite side of
Br from Pr
- for each intersection point Ti,j of the bisectors,
1≤i<n+4, i<j≤n+4
- if the line segment through Ti,j and Pk does not intersect any Bm,
1≤m≤n, m≠i,j
- add Ti,j to Pk's polygon
- if i≤n, add Ti,j to Pi's polygon
- if j≤n, add Ti,j to Pj's polygon