Algorithm for how to Split Large Area into Convex Polygons - algorithm

I'm implementing the A* pathfinding algorithm into a grid based engine, but I'm wanting to create nodes in polygonal areas rather than just using the grid points.
There will be obstacles in the area, that shouldn't be moved through.
I'm wondering is there some algorithm that can split up a larger area with obstacles into a graph with the smallest possible number of connected convex polygons?

There's a lot of them. Typically you're dealing with your triangulation algorithms. You remove the lines that travel through an obstacle and likely do a shortest path algorithm on it. I'm not sure why you want the smallest number of connected convex polygons though, but that could equally be done. The answer is simply the convex hull of the points. One polygon is by definition the smallest number there.

Related

What kind of algorithm do I need to find out the best path to expand a polygon to capture the most points?

I'm trying to find the best way to expand a polygon to contain the most points. A simple greedy algorithm might be to expand with a 1km square, placing the square at the border in a location that captures the most points at that step. But what if I have multiple steps, it might make sense to place a couple empty squares so that the polygon reaches a hub of points. Is there a name for this algorithm? Or a way to implement it with shapefiles?
Do you mean the convex hull (https://web.mit.edu/urban_or_book/www/book/chapter6/6.4.7.html) ?
Algorithms for solving the convex hull problem are in https://en.wikipedia.org/wiki/Convex_hull_algorithms
The convex hull is related to the travelling salesman problem (https://en.wikipedia.org/wiki/Travelling_salesman_problem) ?
https://en.wikipedia.org/wiki/Travelling_salesman_problem#Exact_algorithms and
https://cs.stackexchange.com/questions/1749/dijsktras-algorithm-applied-to-travelling-salesman-problem/1805

Algorithm to create minimal bounding-box composition of point cloud

I have a set of 2D points.
I want to find a set of (possibly overlapping and arbitrarily oriented) bounding-boxes for subsets of these points such that each point lies within at least one box, each box contains at least k points and such that the combined area of the boxes is minimized.
One idea for an algorithm I have is:
use a concave-hull algorithm to find a concave hull for the points.
use convex decomposition algorithm to find a set of convex hulls.
compute arbitrarily oriented minimum bounding box for each of the convex hulls.
I'm looking for a list of other (potentially better suited) algorithms for this problem?

Is there any algorithm for covering a concave polygon(contains holes) with convex polygons

This can be approached in two ways :
i) by partitioning the given polygon into convex polygons such that there is no
overlap between the convex polygons
ii) by covering the given polygon using convex polygons such that their union
gives the original polygon. In this case there can be overlap between
the convex polygons
Although partitioning covers the entire polygon, number of convex polygons can be reduced by second approach. It is also known that covering a concave polygon(second approach) with minimal number of convex polygons is NP-Hard.
I'm specifically looking for algorithms based on second approach mentioned above,but number of convex polygons may not be minimal.
As already mentioned by MBo and Yves Daoust in the comments to your questions. Polygon decomposition into convex polygons can be done by triangulation (or trapezoidal decomposition). This will result for an n vertex simple polygon P with n-2 (interior) triangles, i.e., is linear in the number of vertices.
Another way to construct a convex decomposition would be to use a generalized motorcycle graph. I would assume there must be a simpler way though!
The main idea is to start a motorcycle m for every reflex vertex r in P. Every motorcycle m drives with a given speed in a given direction and leaves a trace behind. If another motorcycle meets such a trace it crashes, i.e., stops but leaves the trace.
Generalized refers to the embedding in P and that the polygon boundaries function as walls where the motorcycles also crash. Furthermore if two motorcycles meet at the same point we have to start another one, or in this case just continue with one and stop the other. After all motorcycles have crashed there is the graph of the traces which in fact is a convex tessellation of P. There are several papers (one here) on this but implementation would be tough. This results in O(r) convex polygons that cover the interior of P.
I think the easiest way is to go with the triangulation or trapezoidal decomposition. These are well studied and available as implementation in many libraries.
Also mentioned in the comments: Input can be produced that will force O(n) polygons. Just think of a star shaped polygon that has n/2 reflex vertices (interior angle > pi).

How to convert a polygon to a set on non-overlapping triangles?

I have a coordinate set of 2D points that form a closed polygon. I need to generate a set of 2D triangles that distribute the polygon completely.
There are no constrains as such except that the triangles should fill the area of polygon completely. It would be even more helpful if it is a standard algorithm I could implement.
The best way to triangulate general polygons is to compute the constrained Delaunay triangulation - this is a standard Delaunay triangulation of the polygon vertices with additional constraints imposed to ensure that the polygon edges appear in the triangulation explicitly. This type of approach can handle any type of polygon - convex, concave, polygons with holes, etc.
Delaunay triangulations are those that maximise the minimum angle in the mesh, meaning that such a triangulation is optimal in terms of element shape quality.
Coding a constrained Delaunay triangulation algorithm is a tricky task, but a number of good libraries exist, specifically CGAL and Triangle. Both these libraries implement an (optimally) efficient O(n*log(n)) algorithm.
As mentioned above, Delaunay triangulation is a rather complicated algorithm for this task. If you accept O(n^2) running time, you may try Ear Clipping algorithm which is much more easier to understand and to code. The basic idea is the following. Every polygon with >= 4 vertexes and no holes (i.e. its border is a single polyline without self-intersections and self-tangencies) has at least one "ear". An ear is a three consecutive vertexes such that the triangle built on them lies inside the polygon and contains no other points of the polygon inside. If you "cut an ear" (add a triangle to the answer and replace remove the middle point of these three points), you reduce the task to a polygon with less vertexes, and so on. Ears may be trivially (by definition) found in O(n^2) resulting in a O(n^3) triangulation algorithm. There is O(n) ear finding algorithm, and, though it is not very complicated, it is rather long to be described in a couple of phrases.
Furthermore, if you need faster algorithms, you should look something about monotone polygons triangulation and splitting a polygon into monotone ones. There even exists a linear-time triangulation algorithm, but its just as complicated as Delaunay triangulation is.
You may consider Wikipedia article and see an small overview of existing methods there.
If you don't require that the vertices of the triangles be vertices of the polygon, try a triangulation based on a trapezoidal decomposition, as in Fast Polygon Triangulation based on Seidel's Algorithm.

Find Minimum Number of Edge-Aligned, Overlapping Rectangles in a Non-Intersecting, Concave Polygon

I am looking for an algorithm or alogirthms I can emply to take a non-intersecting, concave polygon and find a minimum set of edge aligned rectangles partitioning the polygon. The rectangles can overlap (preferably minimally).
I was considering using ear-clipping to find the minimum triangles. I could build rectangles from those triangles. I guess each triangle could have a set of rectangles. Then I examine the rectangles and merge with other, collinear-ish rectangles. I don't know if that is a good approach or not.
I imagine the problem sounds a bit subjective, but I still think there is a good approach for solving this problem with known algorithms and a bit of heuristics.
*EDIT: More with heuristics, I can expect axis-aligned rectangles to be, incidentally, a common occurence.
**EDIT: I can also expect zero of the convex angles to be less than 90 degrees.
Fair warning, I have no background in computation geometry, so I'm basically just making things up. This would be my initial approach to the problem.
Figure out if the polygon is convex. If so, cover it with one rectangle aligned with an edge. To do this, I'd say just try all of the edges and see which one gives the rectangle with the smallest area. There may be a better way to determine which edge to use, but again, no background in this stuff.
If the polygon is concave, let's call an edge a "concave edge" if it's not on the convex hull of the polygon. Find a concave edge in the polygon, and extend it to cut the polygon into two or more new, smaller polygons. Recurse on each of the child polygons.
If the polygon has few enough edges, I think that an exhaustive search would be reasonable, and just pick the matching which covers your heuristic best (fewest rectangles, least amount of space not within the polygon covered, amount of overlap, some function of the previous factors, etc.)

Resources