0
$\begingroup$

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?

Problem description

$\endgroup$
2
  • $\begingroup$ What's the precise definition of when you would consider a connecting path to be in the "clockwise direction"? $\endgroup$
    – D.W.
    Jul 29 at 21:56
  • $\begingroup$ @D.W. I am wondering this myself. As a side note: The line cannot self intersect. To your question: To my human eyes, the definition of clockwise is obvious, but I do not how to translate "clockwise" to logical terms - do you have a suggestion? This similar question only tackles the problem in 2D: stackoverflow.com/questions/1165647/… $\endgroup$
    – Edgar
    Aug 3 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.