# List of triangles to minimum amount of convex polygons

I'm in search for an algorithm that takes the left side of the following graphic as an input and outputs a minimal amount of convex polygons as seen on the right side of the graphic. The input mesh can be very complex and could contain several holes. The position of the vertices are not constrained to a grid.

The use case for this is the creation of multiple polygon shapes for the Box2D physics engine.

• The result does not need to be deterministic.
• The result does not need to be vertically striped.
• As trichoplax noted, the right part of the picture does not resemble the minimal polygon count that can be achieved. It's just an example.
• It's not necessary that it will find the absolute minimum of convex polygons. A fast algorithm is preferred over a "best solution" one.
• I notice that the example output is not minimal according to the definition (there exists an arrangement of 5 convex polygons that covers the mesh). Is this because it's just an example, or are there further requirements that prevent the 5 polygon output being valid? For instance, are the output polygons required to be in vertical strips of fixed width or is that just for the example image? Jul 7, 2017 at 11:18
• Thanks trichoplax. I've added the requested additional information to the question. Hope they clarify your questions.
– Timm
Jul 7, 2017 at 11:41
• I've identified the difference between the example output and the minimal one I was thinking of: Mine covers the area using convex polygons that use only the existing vertices, but do not use the existing triangles. The example output shows the minimal number of convex polygons if they are required to be constructed from the existing triangles. Is this a requirement? Jul 7, 2017 at 15:13
• No this is no requirement. The resulting polygons can be generated with any means available. The only requirement is, that the resulting shape is exactly the same as with triangles.
– Timm
Jul 7, 2017 at 19:23
• This problem is known as convex decomposition. See gamedev.stackexchange.com/q/53142, doc.cgal.org/latest/Partition_2/index.html#title2, masc.cs.gmu.edu/wiki/ACD
– user106
Jul 8, 2017 at 5:02