algorithmpolygongraph-algorithmpoint-in-polygonconvex-polygon

Algorithm for how to Split Large Area into Convex Polygons


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?


Solution

  • 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.