I have a polygon given by
poly = Polygon[ {{2437.21, 166.705}, {2437.38,166.856}, {2440.37,163.438}, {2435.84,159.581}, {2442.18,152.113}, {2431.45,142.989}, {2420.63,153.885}, {2428.72,160.067}, {2418.95,168.237}, {2435.2,183.216}, {2446.11,174.504}, {2437.21,166.705}}] which looks good when rendered:
Graphics[poly] However, this shape cannot be used for Region-related operations as it is "ill-defined" with an interior line:
Graphics[ { FaceForm[None], EdgeForm[Black], poly, Red, PointSize[Medium], Point@@poly }, Frame->True ] whose zoomed-in view is like this:
Graphics[ { FaceForm[None], EdgeForm[Black], poly, Red, PointSize[Medium], Point@@poly }, Frame->True, PlotRange->{{2437, 2438}, {166, 168}}, PlotRangeClipping->True ] My question is: How can I detect such "ill-defined" polygons and fix them?
Edit:
As more people are concerning about the definition of a valid polygon, I just cite that used by the python package shapely here:
Rings of a valid Polygon may not cross each other, but may touch at a single point only.
Also, I have very little expertise in computational geometry; my intention was to use Region-related functions (e.g., RegionMeasure) with these polygons, where I came across the kernel crash and then discovered such "ill-defined" polygons.








poly = Polygon@{{3, 3}/2, {3, 3}, {0,1}, {3, 1}, {2, 2},{3, 3}/2 };? $\endgroup$