gradientspace / geometry3Sharp

C# library for 2D/3D geometric computation, mesh algorithms, and so on. Boost license.
http://www.gradientspace.com
Boost Software License 1.0
1.71k stars 387 forks source link

Convert mesh regions to 2d, alter in 2d, push back into 3d mesh #182

Open wtaisto opened 1 year ago

wtaisto commented 1 year ago

Thank you so much for this fantastic set of tools!

My project involves meshes build up from geometric primatives, which have mostly flat faces joined at right angles. I need to be able to find those continuous flat faces, manipulate them in 2d, then merge the changed region back into the 3d mesh.

I already have code working which:

  1. builds a distinct list of all triangle normals in the mesh (with some floating point fuzz)
  2. uses MeshConnectedComponents to take each group of coplanar triangles and get the connected coplanar subsets
  3. uses MeshRegionBoundaryLoops on each connected coplanar subset to get the outer perimeter and any holes

What i'm not sure how to do is to take those 3d regions, project them into one of your 2d classes, modify the interior of the 2d object (like, say, cut a hole) WITHOUT CHANGING THE BOUNDARIES, unproject the new 2d back into 3d and merge it back into the 3d.

Any recommendations on which of your classes I should look at, or a general gist of what my process should look like, would be hugely appreciated.

Thanks again for sharing this with the community!