The code


produces, according to Mathematica, a disconnected polygon with 0 area. The vertex {1,1} coincides with an edge it is not incident to: it is degenerate. Regardless, I'm looking to get a MeshRegion from it. Even attempting to construct meshes from the more explicitly defined


fails. PolygonDecomposition does well for other degeneracies (i.e. handling 1-dimensional parts of shapes), but not this kind. There may be an easier way to create meshes from path data I'm not aware of. I want to create regions for arbitrary closed paths, possibly with coinciding vertices and edges, so manually creating the proper region is unsatisfactory (e.g.


). Detect and fix invalid polygon has outdated (and even so not applicable) solutions. How to decompose a self intersecting polygon into simple polygons? comes closer with Graphics`PolygonUtils`SimplePolygonPartition, but still outputs incomplete partitions.

  • 2
    $\begingroup$ DiscretizeGraphics[Polygon[{{0, 0}, {3, 0}, {3, 3}, {1, 3}, {1, 1}, {2, 2}, {2, 1}, {0, 1}}]] works fine. $\endgroup$ Feb 24, 2021 at 0:52
  • $\begingroup$ Should I add a self answer? $\endgroup$
    – Adam
    Feb 24, 2021 at 20:03
  • $\begingroup$ I will upvote your answer if you do so. $\endgroup$ Feb 25, 2021 at 2:06

1 Answer 1


From the documentation,

PolygonDecomposition gives a Polygon consisting of a union of polygons with disjoint interiors, but boundaries may overlap.

Technically, the polygon in question has a decomposition into interior-disjoint polygons, but it happens not to be treated that way (Mathematica's documentation seems to mean that adjacent pieces in a decomposition share edges). Instead, its treated like


where the vertex {1,.9} is on the interior. It turns out CanonicalizePolygon is unhappy with interior vertices (and coinciding vertices and edges) as well. Turning away from polygons and towards MeshRegion, we find

MeshRegion is typically created using functions such as DelaunayMesh, DiscretizeGraphics, and DiscretizeRegion.

DiscretizeRegion approximates shapes in steps, and apparently fills the gap entirely. DiscretizeGraphics, as J.M.'s ennui reveals, succeeds. DiscretizeRegion DiscretizeGraphics


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.