3

Is there a code/library that can calculate a Voronoi diagram for planes (parallelograms) in 3D? I checked Qhull and it seems it can only work with points, in its examples Voro++ works with different size of spheres but I couldn't find anything for polygons.

In this image (sample planes in 3d) the parallelograms are 3D since they have a thickness, but in this case the thickness will be zero.!

zamazalotta
  • 423
  • 1
  • 6
  • 11

2 Answers2

3

Voronoi cells are not parallelograms. You are confused here by the image you posted. Voronoi cell borders are parts of the hyperplanes that are separating the individual means.

Check out this website discussing and visualizing 3D voronoi diagrams:

http://www.wblut.com/2009/04/28/ooh-ooh-ooh-3d-voronoi/

In order to compute the voronoi cells, the common way is to first build the Delaunay Triangulation. There are a number of algorithms to do this in 2D, while in 3D it gets significantly more complex. But you should still be able to find something. qhull might be the proper way to go.

When you have the Delaunay triangulation, compute the center of each tetraeder. These are the corners of the polygons that you need to draw. For any edge in the Delaunay triangulation, draw a polygon connecting the adjacent centers. This should be a hyperplane. Now all you need to do is also draw the Hyperplanes for edges that are part of the convex hull. For this you need to continue the hyperplanes that you should already have from the inside to the infinite outside.

I strongly recommend to start with 2d first. Once you have a working code for 2D, see how to do the same in 3D. This is already pretty tricky in 2D if you want it to be fast.

This is a graphic from Wikipedia visualizing both Delaunay and Voronoi diagrams: Delaunay and Voronoi in 2D

The black lines are the Delaunay Triangulation. The brown lines are orthogonal to this, and form the Voronoi diagram. Delaunay triangulation can be used for various cool visualization things: computing the convex hull, the voronoi diagrams and alpha shapes: http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Alpha_shapes_3/Chapter_main.html

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
  • I think my question wasn't clear enough. Let me try to clarify it. When you do a Voronoi diagram for points the cells that you get are the regions closest to a certain point. What I want to do is do the Voronoi for these parallelograms and so that each Voronoi cell defines the region closest its corresponding parallelogram. I can figure out how to do it in 2D (define points as vertices of the rectangles and then sum all the 4 up to get a total region and so on...) but 3D is really complex so I can't trust myself. That's why I am searching for a robust/tested code/paper/algorithm – zamazalotta Feb 11 '12 at 19:32
  • Even in 2d, the corners will not work. I can easily draw a situation where you fail when you take just the corners. Say R1 is 0,0 0,1 1,1 1,0, and R2 is -50,50 50,-51 50,-52 -51,49. What you need is the closest set of points on the rim of each pair of objects. When a set of edges/planes is parallel, you need the minimum and maximum (in 3d, four pairs). – Has QUIT--Anony-Mousse Feb 11 '12 at 21:27
1

Bowyer-Watson is usually the recommended algorithm. The problem with most papers/algorithms is that they don't address the tricky situations that arise when points are close to each other in space (so the tetrahedrons are thin), when voronoi cells should end up mostly flat and when multiple points are on the same sphere. Add to that the numerical complexity of dealing with inaccurate math and rounding and you have yourself a recipe for endless debugging. My recommendation is that you filter your data first if that's acceptable. Otherwise, you will end up coding an enormous amount of special cases in your algorithm.

A while ago, there was also a Japanese paper that claimed to have a different approach for resolving these situations by starting from the delaunay triangulation and working out the voronoi cells from that, but it too was flawed. It must be nice to be a researcher, coming up with the broad lines of algorithms and letting the research assistants worry about the details...