# Cutting a 3D mesh with a 2D shape

I have a 2D image that i want to use to cut into a 3D mesh while leaving it closed (basically cut straight through it, and close it by generating vertices in both places it cut, front and back, to close the hole). The shape i'm cutting through is a manifold and i'm wondering if there's an easy & fast way to do it considering the shape is very high resolution (3K texture).

• The 2D Shape in the image is closed but complex (probably thouthand of points vectorized)
• The target mesh is a closed mesh, the odd case of intersecting with an edge of the mesh can be ignored in my case so the shape will either not intersect at all or intersect with 2 points (front and back of the mesh).

I guess i could simply vectorize the shape and then create a mesh from that and do a mesh-mesh intersection but i'm wondering if there's an easier / faster way to do it directly from the source texture.

• How precise does your cutting need to be with regards to the shape of the "cutter"? One thing you could do to reduce complexity is to generate a simpler mesh for the 2d by sampling the texture radially to find the furthest point from the center. For example, start at 0 (say straight up), sample the distance to the center and add as point to new mesh, move 45 degrees sample, repeat. As for the cutting, if you allow some inaccuracy you just do a check that the size of the simple 2d mesh is big enough, and just do a plane intersection? – MistaGiggles Jul 3 '15 at 13:35
• @MistaGiggles It needs to be very precise, most likely close to 1 vertex per pixel in the original texture's shape. And the point where it intersect has to be very precise (i'm not looking for a yes/no answer to does it intersect, but for where to outline the mesh). This doesn't need to be realtime at all and will run on a pretty massive server, i'm just wondering if i missed something obvious i could do that would be more efficient than generating a mesh and doing a mesh-mesh colision – Ronan Thibaudau Jul 3 '15 at 13:38
• If your accuracy is that fine grained, you may benefit from doing the cut in voxel space. The method I'm imagining would be to voxelise the mesh to the precision you need (you can treat the texture data as voxel data directly), perform a subtraction on the voxel data and tesselate back to a mesh. The reason I suggest this is that the mesh->voxel and voxel->mesh operations are highly parallelisable and would allow you to take advantage of a lot of processing power. – MistaGiggles Jul 3 '15 at 14:09
• Sounds too complex and i definately don't have the voxel knowledge to do this. I'm hoping for something simpler than my original solution, not more complex as i have to do it all (third party libraries are a no-no) – Ronan Thibaudau Jul 3 '15 at 14:14