Skip to main content

Homework 5: Voronoi Diagrams

Part 1: Book Problems

Prepare a PDF file named hw5_voronoi_diagrams.pdf with your answers to the book problems below. You may use Latex, Google Docs (export/save as PDF), MS Word (export/save as PDF), and/or legibly handwrite on paper and scan to PDF.

From "Computational Geometry: Algorithms and Applications", de Berg, Cheong, van Kreveld, and Overmars.

You may discuss these problems with your classmates, but you must write up your solutions individually. Note the names of anyone you talked to or collaborated with in your hw5_voronoi_diagrams.pdf writeup.

Please do not search for solutions or notes published by the authors or any instructor or notes or solutions shared by other students on the internet. Any use of these types of materials is considered a violation of Academic Integrity for this course.

7.5
Give an example where the parabola defined by some site p_i contributes more than one arc to the beach line. Can you give an example where it contributes a linear number of arcs?
Draw these examples and include them in your .pdf.

7.11
Let P be a set of n points in the plane. Give an O(n log n) time algorithm to find for each point p in P another point in P that is closest to it.

7.19
Suppose that we are given a subdivision of the plane into n convex regions. We suspect that this subdivision is a Voronoi diagram, but we do not know the sites. Develop an algorithm that finds a set of n point sites whose Voronoi diagram is exactly the given subdivision, if such a set exists.

Part 2: CGAL Programming Task

Given a 2D simple polygonal outline (no crossings of the boundary, and no interior holes), and a number k, find a centroidal voronoi tesselation. That is, identify the positions of k sites that define a Voronoi Diagram with k areas such that the centroid of each Voronoi region is the position of the site defining the region.

For example given a square an k = 5 there are 3 solutions:

The images above are from the Centroidal Voronoi Tesselation Wikipedia page.

You will start with a random initial placement for the sites and use an iterative algorithm (Lloyd's algorithm a.k.a. K-means clustering) to converge to an approximate solution (with a small epsilon tolerance). Depending on the input shape and requested number of sites, there will likely be multiple valid answers. Your program may return any of these answers.

Here is a sample command line:

    ./centroidal_voronoi_tessellation ../src/input_square.txt 5 output_square_5.txt
  

And an incremental visualization of the initial iterations of Lloyd's algorithm:
(Your program will only visualize the final converged state.)

In solving this problem, you may find the following CGAL packages helpful:

 

Here are a few additional examples:

    ./centroidal_voronoi_tessellation ../src/input_rectangle.txt 4 output_rectangle_4.txt
    ./centroidal_voronoi_tessellation ../src/input_hexagon.txt 7 output.txt
    ./centroidal_voronoi_tessellation ../src/input_l_shape.txt 5 output.txt
    ./centroidal_voronoi_tessellation ../src/input_l_shape.txt 12 output.txt
  


For extra credit, extend your program to output multiple solutions. Your program will re-run your core algorithm in a loop, filtering out duplicate solutions.

Sample input & output files: