Complexity of the vertices of a decomposed simple polygon to its cells - computational-geometry

Given a simple polygon (without holes), consider a given decomposition of the polygon into convex sub-polygons. Suppose there are m number of convex sub-polygons and the number of the vertices of the decomposed grid is v. I am looking for the complexity of v in m.

Related

Merging two Convex Hulls with minimum perimeter

assume that we have two (or more) convex hulls in the plane and we want merging them. but the convex hull result has minimum perimeter. is any algorithm available for this?
You can run any optimized convex hull algorithm on the boundary point of two convex hulls, you should get a new convex hull covering both of the previous ones. To maintain the convex property, there will be a unique resultant convex hull, so the minimum perimeter should not be a constraint.
Split all K hulls in upper and lower hulls. Now you have 2K sorted sequences of vertices. Merge the upper and lower sequences separately, using a K-way merge. This is done in time O(N log(K)) where N is the total number of vertices.
Now two Graham scans give the global hulls in time O(N).
[This is an adaptation of the monotone-chain algorithm.]

Fastest algorithm to compute the shortest distance between 2 regions of set of points [duplicate]

I want to find the minimum distance between two polygons with million number of vertices(not the minimum distance between their vertices). I have to find the minimum of shortest distance between each vertex of first shape with all of the vertices of the other one. Something like the Hausdorff Distance, but I need the minimum instead of the maximum.
Perhaps you should check out (PDF warning! Also note that, for some reason, the order of the pages is reversed) "Optimal Algorithms for Computing the Minimum Distance Between Two Finite Planar Sets" by Toussaint and Bhattacharya:
It is shown in this paper that the
minimum distance between two finite
planar sets if [sic] n points can be
computed in O(n log n) worst-case
running time and that this is optimal
to within a constant factor.
Furthermore, when the sets form a
convex polygon this complexity can be
reduced to O(n).
If the two polygons are crossing convex ones, perhaps you should also check out (PDF warning! Again, the order of the pages is reversed) "An Optimal Algorithm for Computing the Minimum Vertex Distance Between Two Crossing Convex Polygons" by Toussaint:
Let P = {p1,
p2,..., pm} and Q = {q1, q2,...,
qn} be two intersecting polygons whose vertices are specified
by their cartesian coordinates in
order. An optimal O(m + n)
algorithm is presented for computing
the minimum euclidean distance between
a vertex pi in P and a
vertex qj in Q.
There is a simple algorithm that uses Minkowski Addition that allows calculating min-distance of two convex polygonal shapes and runs in O(n + m).
Links:
algoWiki, boost.org, neerc.ifmo.ru (in russian).
If Minkowski subtraction of two convex polygons covers (0, 0), then they intersect

Shortest distance between two polygonal lines

I'm trying to calculate the shortest distance between two polygonal lines. I had thought of using a sweep algorithm but I don't know what events to take into account because the vertical ray can intersect between two vertices, a vertex and an edge or two edges. What will my events be? Is there any other way to calculate the distance?
The minimum distance will always be achieved by a segment one end of which is a vertex of one of the polygonal chains P1 or P2. Even if the min distance is achieved by two parallel edges, an endpoint of those edges also realizes the min distance.
So a naive algorithm is to iterate over all vertices v1 of P1, find the minimum distance from v1 to P2.
The problem of finding the minimum distance between v and P can iterate over each edge of P.
What I am describing is a quadratic algorithm. If you want to achieve the optimal O(n log n), you will need to compute a Voronoi diagram.

Point location in 3D convex polyhydron

Let P be a 3D convex polyhedron with n vertices.
1. Given an algorithm that takes an arbitrary point q as input, how can I decide in O(n) time whether q is inside or outside the convex polyhedron?
2. Can I do some processing to make it O(logn)?
For (1), if you have a convex polyhedron with n vertices then you have also O(n) faces. One could triangulate each face and in total it would still be O(n) triangles. Now take the query point q and check on which side of a triangle q lies. This check takes O(1) for one triangle, thus O(n) for all triangles.
EDIT: The O(n) faces define O(n) planes. Just check if q lies on the same side for all planes.
For (2), (I did not find source for this but it seem reasonable) one could project the polyhedron P as P' onto a plane. P' can be seen as two separate planar graphs, one graph U' for the upper part of the polyhedron and the second graph L' for the lower part. In total there are O(n) faces in L' and U'. Now one can preprocess L' and U' via Kirkpatrick optimal planar subdivision algorithm. (Other sources for it: 1 and 2) This enables O(log n) point in PSLG (planar straight line graph) checks.
Now using the query point q and projecting it to the same plane with the same projection one can look up the face of L' and U' it lies in in O(log n) time. In 3D each face lies in exactly one plane. Now we check on which side q lies in 3D an know if q is inside the polyhedron.
Another approach for (2) will be spacial subdivision of the polyhedron into slubs - pyramids with their vertex in the polyhedron centroid and polyhedron faces as their bases. Number of such slabs is O(n). You can build a binary space partitioning tree (BSP), consisting of these slubs (probably divided into sub-slubs) - if it's balanced, then the point location will work in O(logn) time.
Of course, it will make sense, if you need to call the point location function many times - because the pre-processing step here will take O(n) time (or more).

Efficient Way to construct triangles from Edges/Lines?

Lets say I have a set of points and I have lines/edges between them. All of these edges create non-overlapping triangles within the convex hull of my points. All points are connected to triangles.
How can I efficiently check which points are part of which triangle? I could check incident points of each edge and gradually construct a triple of points, but that sounds awefully slow (o(n^2)?).
Is there something like linesweep or so to do that?
cheers.
If you have a 2-dimensional set-up like you described, then you have a fully triangulated planar graph (no intersecting edges when you exclude the endpoints) which spans the convex hull of your points. In this case, if you sort the edges around each vertex circularly according to the angle they make with the vertex, then you know for sure that each pair of adjacent edges makes a triangle. Furthermore, every triangle can be found this way if you perform this procedure for each vertex. Each triangle will be found 3 times when you iterate over all vertices. You can either use a hash table to detect duplicates, or sort all your triangles when you are done to identify duplicates. If you use hash table, then the overall complexity if you have V vertices is O(V log d), where d is the maximum degree of a vertex (because the total number of edges is linear in the number of vertices because you have a planar graph). So absolute worst-case is O(V log V), which is the same worst-case if you sort all triangles to find duplicates (because the max number of triangles is also linear in the number of vertices). The only caveat to make this work is that you need to know the neighbor vertices (i.e. the incidental edges) for each vertex.
The edges define an undirected graph G and the triangles are the set of cycles in G with length=3.
Geometric triangulations typically have relatively low nodal degree (degree d is the number of edges adjacent to each node, d<=10 is typical for geometric triangulations) and, as such, here is a reasonably efficient O(n*d^3) algorithm that can be used to construct the set of triangles.
Setup a graph-like data structure, supporting access to the list of edges adjacent to each node.
Iterate over all nodes. Consider all pairs of edges adjacent to a given node i. For a given pair of edges adjacent to i, we have a potential nodal triplet i,j,k. This triplet is a triangle if there is an edge joining nodes j,k, which can be checked by scanning the edge lists of j,k.
Duplicate triangles will be generated by a naive implementation of (2). Maintain a hash table of triangles to reject duplicate triplets as they're considered.
I've assumed that the edges define a valid disjoint triangulation, being non-intersecting, etc.
Hope this helps.

Resources