1
\$\begingroup\$

I would like to project a number of separate 3D meshes onto a 2D plane and create a 2D polygon representing the outline of all the meshes. I would also like to to create multiple 2D polygons if the projection creates separate islands (see blue and green polygons in the image below). I would like to do this so I can use the generated 2D geometry for 2D collision detection.

If anyone knows of an algorithm to do this or even just some better search terms that would be very helpful, thank you!

3D view of the meshes to project:

3D View of meshes

View of what the 2D polygons would look like when projected from the top (blue and green shapes):

Polygons generated from 3D meshes

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I'd recommend splitting this into steps. First project all vertices onto the plane. Now you don't have 3D meshes at all, just a collection of 2D triangles or quads. (You could even discard the ones that project to zero or negative area). Since it's a purely 2D problem now, you can search "merge polygons algorithm" or "polygon union" to find existing answers about how to do the next part. \$\endgroup\$
    – DMGregory
    Nov 7 '21 at 12:54
  • \$\begingroup\$ I think this is a good way to go about it. I could do something like backface culling by checking the normals of each face and discarding the ones which face away from the projection plane. The Clipper library looks like it could probably handle the union of the remaining polygons. I'll give it a go, thanks! \$\endgroup\$
    – Path
    Nov 8 '21 at 4:42

You must log in to answer this question.

Browse other questions tagged .