I want to compute Voronoi and its dual, Delaunay triangulation. I am using Watson Bowyer algorithm. My goal afterwards is to compute alpha-shapes (concave hulls). So I will need to rapidly access the voronoi cell for a given point, the neighbors...
Which data structures did you use for your Voronoi/Delaunay algorithm? I have thought of using a disjoint set data structure with union-find operations, so that I can 'bind' to one parent, the point p in original data set, the set of point in Vp. However, one point in Voronoi diagram 'belongs' to several Voronoi cells.
What is your advice, or could you hint at some good reference?
Regards.
I suggest that you take a look at the half-edge data structure:
http://www.flipcode.com/archives/The_Half-Edge_Data_Structure.shtml
Half-edge data structure is used in many applications and frameworks. One implementation of it is found in the GEL framework:
http://www2.imm.dtu.dk/projects/GEL/
Related
I have a collection of lines in my diagram and I also have a point. What I want is a collection of lines which will together form a polygon through a ordered traversal. I don't need implementation or anything all I want is someone to direct me towards the algorithm I can use.
Similar problem like this have been asked but won't work for me because
One of the common asked problems is that given a polygon I need to find whether the point lies inside it or not but this won't work for me because I don't have any polygons I only have a collection of lines.
the final polygon can be convex too so simply drawing rays on every side from that point and finding intersections won't work I need something more advanced.
Sorry for all the confusion : See this for clarity https://ibb.co/nzbxGF
You need to store your collection of segments inside a suitable data structure. Namely, the chosen data structure should support the concept of faces, as you're looking for a way to find the face in which a given point resides. One such data structure is the Doubly Connected Edge List.
The Doubly Connected Edge List is a data structure that holds a subdivision of the plane. In particular, it contains a record for each face, edge, and vertex of the subdivision. It also supports walking around a face counterclockwise, which allows you to know which segments bound a particular face (such as the face containing the point you're searching for).
You can use a Sweep Line Algorithm to construct the Doubly Connected Edge List in O(nlog(n)+klog(n)) where n is the number of segments and k is the complexity of the resulting subdivision (the total number of vertices, edges, and faces). You don't have to code it from scratch as this data structure and its construction algorithm have already been implemented many times (you can use CGAL's DCEL implementation for example).
With the Doubly Connected Edge List data structure you can solve your problem by applying the approach you've suggested in your post: given an input point, solve the Point in Polygon problem for each face in the Doubly Connected Edge List and return the set of segments bounding the face you've found. However, this approach, while might be good enough for somewhat simple subdivisions, is not efficient for complex ones.
A better approach is to transform the Doubly Connected Edge List into a data structure that is specialized in point location queries: The Trapezoidal Map. This data structure can be constructed in O(nlog(n)) expected time and for any query point the expected search time is O(log(n)). As with the Doubly Connected Edge List, you don't have to implement it yourself (again, you can use CGAL's Trapezoidal Map implementation).
There are quite many algoritms for finding Voronoi diagram with Euclidean distance. However, I haven't found any algorithms other distance functions, for example, Manhattan distance (perhaps, because of no practical applications).
You can see example at Wikipedia:
https://en.wikipedia.org/wiki/Voronoi_diagram#/media/File:Manhattan_Voronoi_Diagram.svg
Manhattan Voronoi diagram also consists of polygons (but non-convex), so I guess that algorithm similar to Fortune's algorithm can be constructed.
However, using more complex distance functions, boundaries won't be polygons anymore. There will be need in different data structure and algorithm.
Are there any algorithms for finding Voronoi diagram with specific distance function (in 2D for simplicity)?
Note:
I don't need an algorithm which works with pixels, it's pretty straightforward, I need algorithm, which founds the boundaries of cells.
Note 2
Practically I need Voronoi diagram with distance function abs(dx)^3 + abs(dy)^3, however, theoretically, I'm interested how one do make an algorithm for other distance functions.
Here is how Voronoi with abs(dx)^3 + abs(dy)^3 look like. Sites are continous and their edges resemble graphs of y=x^3 (just assumption).
Most likely you can use the pixel taxi voronoi and give each polygon a different color. You can then use a pixel color test to check the bounds.
There is a problem in my book that uses the concept of closest-point and farthest-point Voronoi diagrams to construct a minimum width annulus for a set of points (used in coordinate measurement machines).
What I need to know:
Say you construct the closest-point voronoi diagram (CPVD) and the farthest-point voronoi diagram (FPVD) on a set of points P. What is an efficient way to find the intersections between the CPVD's edges and the FPVD's edges (if you overlay the two diagrams) if you know there are only O(n) intersections.
I just can't think of a way that is faster than O(n^2). Is there some property I'm glossing over?
I have some polygons (obstacles) within a rectangle (the borders are obstacles) and I want to find the Voronoi diagram, that means the diagram that shows the lines that have equal distance to two obstacles.
For example (created with this, please ignore the smiley and the flag):
The voronoi diagram seems to be not a set of polygons (which would be easy to represent). This one seems to have curves. It was generated by calculating for each pixel the distance to each obstacle.
I have seen this, but it has no polygons, but only points.
How can I represent such a voronoi diagram?
(By the way, I would also be happy if you had some good articles about this voronoi path planning problem ... I can only find many for points as obstacles.)
You may use the Voronoi Diagram implementation from Boost.Polygon. Maybe if you want your own implementation you can learn looking at the Boost source code.
The Boost.Polygon library provides implementation of the Voronoi
diagram data structure in 2D space. The internal representation
consists of the three arrays, that respectively contain: Voronoi cells
(represent the area around the input sites bounded by the Voronoi
edges), Voronoi vertices (points where three or more Voronoi edges
intersect), Voronoi edges (the one dimensional curves containing
points equidistant from the two closest input sites). Each of the
primitives (cell, vertex, edge) contains pointers to the other linked
primitives, so that it's always possible to efficiently traverse
Voronoi graph.
There is also this link with a visual representation from that data structure.
Can someone point me to a reference implementation on how to construct a (multiplicatively and/or additively) weighted voronoi diagram, which is preferably based on Fortune's voronoi algorithm?
My goal:
Given a set of points(each point has a weight) and a set of boundary edges(usually a rectangle) I want to construct a weighted voronoi diagram using either python or the processing.org-framework. Here is an example.
What I have worked on so far:
So far I have implemented Fortune's algorithm as well as the "centroidal voronoi tessellation" presented in Michael Balzer's paper. Algorithm 3 states how the weights need to be adjusted, however, when I implement this my geometry does not work anymore. To fix this the sweep-line algorithm has to be updated to take weights into account, but I have been unable to do this so far.
Hence I would like to see how other people solved this problem.
For additively weighted Voronoi Diagram: Remember that a power diagram in dimension n is only a(n unweighted) Voronoi diagram in dimension n+1.
For that, just recall that the Voronoi diagram of a point set is invariant if you add any constant to the coordinates, and that the weighted Voronoi diagram can thus be written as a non weighted Voronoi diagram using the coordinates, for example in 2D lifted to 3D:
(x_i, y_i, sqrt(C - w_i))
where w_i is the weight of the seed, and C is any arbitrarily large constant (in practice, one just small enough such that C-w_i is positive).
Once your diagram is computed, just discard the last component.
So, basically, you only need to find a library that is able to handle Voronoi diagrams in dimension n+1 compared to your problem. CGAL can do that. This also makes the implementation extremely easy.
This computation is not easy, but it is available in CGAL. See the manual pages here.
See also the Effective Computational Geometry project, which employs and
supports CGAL:
There is little `off-the-shelf' open source code out there, for the case where distances to the centers are weighted with a multiplicative factor.
To my knowledge, none of the current CGAL packages covers this case.
Takashi Ohyama's beautifully colorful website provides java implementations
http://www.nirarebakun.com/voro/emwvoro.html
for up to 100 points with a SIMPLE algorithm (Euclidean and Manhattan distances).
There is also a paper describing this simple intersection algorithm and an approximate implementation within O(n^3) time, as a plugin to TerraView.
However, I cannot find the source of this plugin in the TerraView / TerraLib repository:
http://www.geoinfo.info/geoinfo2011/papers/mauricio1.pdf
Aurenhammer and Edelsbrunner describe an optimal n^2 time algorithm, but I'm unaware of available code of that.
If you are comfortable digging into Octave, you could reference the code provided in their library.