How to programmatically extract the "top of the roof" for a straight skeleton structure?

122 Views Asked by At

I'm referring to this Straight Skeleton. For example, after generate a straight skeleton structure for a strictly simple polygon such as below, my goal is to extract the red line. At first, I figure it would be simply not including the edges which contain vertex lie on the polygon contour, but I soon realised with cases such as the second figure, even with doing so, I would still have some "branches" left that is not filtered out.

Any suggestion? enter image description here enter image description here