I am looking for an algorithm to a problem that I encountered when working with 3D modeling:
On a 3D triangle surface mesh, I have multiple lines, some of them are open, some are closed. The are on one side of each line is defined as inside
, the area on the other side of the line as outside
. Inside is shown with small strokes next to the line. Now I have to close all open lines with connecting lines. The end goal is to use the lines to perform a boolean operation on the mesh. Rules:
- It is possible to connect multiple open lines together, or to connect an open line with itself.
- The solution must be such that all areas that are defined through the lines are consistent on whether they are inside or outside.
- All open lines must be closed in the final solution.
At the moment, I am tackling the problem with a planar graph and looking for paths through the graph. I tried the shortest path and traveling salesman/hamiltonian path, but both fail to comply with rule 2. Since the closed lines are needed to find the correct solution, and they are not part of the graph, possibly a graph is the wrong tool in the first place.
I appreciate any ideas. The more precise, the better - step-by-step instructions or pseudocode is perfect - but also if you just have a rough idea in mind, please share.
Edit: Some clarifications in response to comments: The black lines cannot overlap. The area of the closed polygons must be bigger than 0. I am looking for any solution atm. The open lines are open polygonal chains.
Below are some images for clarification: