Closest-point and farthest-point Voronoi diagrams - algorithm

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?

Related

Voronoi site points from Delaunay triangulation

How can one determine the exact Voronoi sites (cells/regions) from a Delaunay triangulation?
If one has an already constructed delaunay triangulation it is easy to calculate the edges of a voronoi by simply connecting adjacent circum-circle centers of every triangle.
It is also easy to determine the Voronoi points/sites because they are represented by every point of every triangle in the Delaunay triangulation.
However how do you determine that a specific voronoi site goes with a specific list of edges from a delaunay triangulation?
It seems it is simple to get one and the other as separate entities but putting them together is another challenge?
Looking at the diagram below, you can see the Delaunay triangulation along with the dual Voronoi diagram. All that I described can be pictured below for an easy reference. Ignore the green circle as that is just an artifact of this particular reference i took from the web.
If you want polygons from edges pick the midpoint of each edge and the distance to each site then sort the result and pick the first and second (when they are equal) and save them into polygons. For the borders there is of course only 1 edge. Maybe a dupe:Getting polygons from voronoi edges.
It's a bit tricky and hard to visualize. I am little stuck with the borders. Here is the original answer from Alink:How can I get a dictionary of cells from this Voronoi Diagram data?.
Each vertex in the Delaunay triangulation represents a Voronoi site. So to create the cell of a site you take one such triangle t and a vertex v in t. Now compute the Voronoi edges between v and the two remaining vertices of t. Repeat this process by traversing the triangles around v one by one. Assuming you can store the neighbourhood relation between the triangles this should at most take O(k) time, k being the number of adjacent triangles of v.
This converts the Delaunay triangulation into the Voronoi Diagram in O(n) time/space, for n sites. No sorting is required, otherwise what is the point in having the Delaunay triangulation in the first place.

Fire Departments covering area

Given a set of points (GPS coordinates), and a polygon that contains all those points, can one determine how well those points are covering the area or what the longest distance from any location within the polygon to the nearest point is?
For example, if I have all fire departments within the city boundary of New York, I want to know how long a fire truck has to drive (in case of an emergency) in the worst case.
Any ideas on what the name of this problem is or what this problem can be reduced to? Or are there any existing algorithms for that?
Thank you :)
First construct the Voronoi diagram of the set of sites (GPS coordinates). The Voronoi diagram is a data structure representing a partition of the plane into cells, one cell for each site, such that each site's cell consists of all the points closer to that site than to any other site.
Constructing the Voronoi diagram can be done in O(nlog(n)) using Fortune's sweep-line algorithm where n is the number of input sites.
Then iterate over the Voronoi cells. Each cell is a polygon. For each cell compute the distance between the cell's site and each of the polygon's vertices. The longest distance between a site and a vertex of the site's cell is the longest distance one would have to walk in order to reach the site.
The running time of the algorithm is O(nlog(n)) as the second phase of the algorithm (iterating over the vertices of each Voronoi cell) requires only linear time. This is because the total number of vertices in the whole diagram grows linearly with the number of sites. Namely, it's not too difficult to show using Euler's formula for planar graphs that the total number of Voronoi vertices is bounded from above by 2n-5.
You can find some open source implementations of Fortune's algorithm on the web. This one for instance.

How to find Voronoi diagram with specific distance function?

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.

Confusion on Delaunay Triangulation and Largest inscribed circle

I need to find a largest inscribed circle of a convex polygon, I've searched many sites and I get that this can be done by using Delaunay triangulation. I found a thread in CGAL discussion with an algorithm using CGAL:
You can compute this easily with CGAL:
First, compute the Delaunay triangulation of the points.
Then, iterate on all the finite faces of the triangulation.
For each finite face f
compute its circumcenter c
locate c in the triangulation (to speed up things, you can give one
vertex of f as starting hint for the point location)
if the face returned by locate(c,hint) is finite, then the circumcenter
c lies in the convex hull of the points, so, f is a candidate
if f is such a candidate face, compute its squared circumradius
keep only the face with minimum squared circumradius
The CGAL manual (chapter 2D triangulation, together with a few things
from the kernel) shows every basic function to do this.
I was a bit confused with the last part of this algorithm. When I read it what I understand from it is that the minimum circumradius of the triangulation face is the radius for the largest inscibed circle. But from examples of polygon with Delaunay triangulation, it seems that even the smallest circumcircle sometimes cannot fit inside the polygon, so how can this has the same radius as the largest inscribed circle?
Maximum inscribed circle in polygons.
The classical computational-geometry solution to the maximum inscribed circle problem for polygons is to use the generalized Voronoi diagram of the polygon's faces resp. the medial axis of the polygon. This approach works in a more general setting like polygons with holes, see this stackoverflow answer to a similar question.
Convex input.
The convexity of your input polygon, however, gives the problem more structure, which I would like to comment on. Consider the following convex input polygon (black), the Voronoi diagram (blue), and the maximum inscribed circle (green) centered on a Voronoi node.
The classical Voronoi-based solution is to (i) compute the Voronoi diagram and (ii) take the Voronoi node with largest clearance (i.e., distance to its defining faces).
The Voronoi diagram of a polygon with holes (i.e., the set of vertices and edges) can be computed in O(n log n) time, c.f. Fortune's algorithm (1986). Later Chin et alii (1999) gave an O(n) algorithm for the medial axis of a simple polygon.
For convex polygons, however, a time-optimal algorithm for Voronoi diagram that runs in O(n) time was already known in 1989 due to Aggarwal et alii. This algorithm follows basically the following idea: Consider the grey offset curves moving inwards at unit speed. If you project this movement into three-space where the z-axis is time you get a unit-slop roof over the polygon:
This roof model could also be characterized as follows: Put a half-space on each polygon edge at 45° slope with polygon (such that they contain the polygon) and intersect them all. So if you can quickly compute the intersect of half-spaces then you can also quickly compute Voronoi diagrams of convex polygons. Actually, for the maximum inscribed circle problem we do not need to go back to the Voronoi diagram but take the one peak of the roof, which marks the center of the maximum inscribed circle.
Now the half-spaces are dualized to points, and then the intersection of half-spaces corresponds the convex hull of its dual points. Aggarwal et al. now found an O(n) algorithm for the convex hull of points that stem from this setting.
A summary of this construction that leads to a Voronoi diagram algorithm for convex polyhedra in any dimension can be found in a blog article of mine.
Simple & fast implementation. A simpler algorithm to compute the Voronoi diagram is motivated by straight skeletons. For convex polygons the Voronoi diagram and the straight skeleton are the same.
The algorithm behind the straight-skeleton implementation Stalgo basically simulates the evolution of the wavefront structure (the grey offset curves). For convex polygons this reduces to finding the sequence of edges that collapse.
So a simple O(n log n) algorithm could look like this:
Construct a circular list of the polygon edges. Compute the collapse time of each edge during wavefront propagation, and insert this event into a priority queue.
Until the queue is empty: Take out the next edge-collapse event: Remove the edge from the circular structure and update the collapse times of the neighboring edges of the removed edge.
Actually, you can simplify the above algorithm further: You do not need to update edge collapses in the priority queue but simply insert new ones: Since the new collapse time of edges are strictly lower, you always get the right event first and dismiss the others and the queue is not growing larger than 2n. Hence, you do not compromise the O(n log n) time complexity.
For the maximum inscribed circle problem you can simplify the above algorithm even further: The Voronoi node (resp. straight skeleton node) you look for is due to the collapse of the final triangle at the end of the loop over the priority queue.
This algorithm should be quick in practice and only a few lines of code.
The last step can mean to select the minimum face of the triangle. Then rinse and repeat.

How can I represent a voronoi diagram?

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.

Resources