I have an algorithmic problem that I am hoping someone can help me out with:
Given: 3D triangle surface mesh, an open polygonal chain (blue).
Wanted: A line that closes the blue line in clockwise direction (green).
The green line provides a correct solution, the red line a wrong solution. Using a shortest path algorithm, the result will be randomly oriented depending on the mesh. How can I guarantuee that the resulting closed polygon is in clockwise direction, i.e. I always get the green line as a result? The direction of the blue line cannot be changed.
Many thanks in advance!
Edit: This is a different question that gave me an idea: https://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-points-are-in-clockwise-order. Maybe it is possible to calculate (x2 − x1)(y2 + y1) for each edge and give penalties for edges where this is > 0 or < 0?