Skip to main content
1 of 3
Anton
  • 2.1k
  • 1
  • 7
  • 23

Find Outer Boundary Of A Non-Convex Self-Intersecting Polygon

Consider a self-intersecting non-convex polygon:

points = {{0, 0}, {2, 0}, {11, 4}, {-1, 4}, {4, .5}, {6, 7}, {7, 0}, {10, 0}, {10, 6}, {0, 6}}; 

I need to find the polygon's outer boundary (in red):

boundary={{0,0},{2,0},{3.660194174757282,0.7378640776699029},{4,0.5},{4.138613861386139,0.9504950495049506},{6.701492537313434,2.0895522388059704},{7,0},{10,0},{10,3.555555555555556},{10,4},{10,6},{6.142857142857142,6},{6,7},{5.692307692307692,6},{5.692307692307692,6},{0,6},{0,4},{-1,4},{0,3.3000000000000003}}; { Graphics@Thread@Line@Transpose[{points, RotateLeft@points}], Graphics@{Red, Thread@Line@Transpose[{boundary, RotateLeft@boundary}]} } 

enter image description here

WindingPolygon, OuterPolygon and their combinations fail:

{ Graphics@Thread@Line@Transpose[{#,RotateLeft@#}]&@WindingPolygon[points][[1]], Graphics@Thread@Line@Transpose[{#,RotateLeft@#}]&@OuterPolygon[Polygon@points][[1]], Graphics@Thread@Line@Transpose[{#,RotateLeft@#}]&@OuterPolygon[WindingPolygon[points]][[1]] } 

enter image description here

What is the proper way to solve this problem?

Anton
  • 2.1k
  • 1
  • 7
  • 23