SimplePolygonQ[poly]
gives True if the polygon poly is simple and False otherwise.
SimplePolygonQ
SimplePolygonQ[poly]
gives True if the polygon poly is simple and False otherwise.
Examples
open all close allBasic Examples (2)
Test whether a polygon is simple:
𝒫 = Polygon[{{0, 0}, {1, 0}, {0.5, 0.8}}]SimplePolygonQ[𝒫]SimplePolygonQ gives False for non-simple polygons:
𝒫 = Polygon[{{0, 0}, {1, 0}, {0.2, 1}, {0.9, 1}}]SimplePolygonQ[𝒫]Scope (5)
SimplePolygonQ works on polygons:
𝒫 = Polygon[{{0, 0}, {1, 0}, {0.5, 0.8}}]SimplePolygonQ[𝒫]SimplePolygonQ[Triangle[]]SimplePolygonQ[Rectangle[]]𝒫 = Polygon[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {1, 2}, {2, 2}, {2, 1}}, {1, 2, 3, 4} -> {{5, 6, 7, 8}}]SimplePolygonQ[%]𝒫 = Polygon[{{0.35, 0.2}, {0.9, 0.75}, {0.1, 0.55}, {0.9, 0.35}, {0.42, 0.9}}]SimplePolygonQ[%]Polygons with disconnected components:
𝒫 = Polygon[{{0, 0}, {1, 0}, {0, 1}, {1, 1}, {2, 1}, {1, 2}}, {{1, 2, 3}, {4, 5, 6}}]SimplePolygonQ[%]Polygon[{{2, 3, 1, 0}, {6, 9, 1, 0}, {5, 4, 1, 0}, {8, 2, 1, 0}}];SimplePolygonQ[%]Applications (2)
Generate random polygons for testing algorithms and verification of time complexity:
n = Table[Floor[10 ^ i], {i, 1, 4, 1 / 40}];polygons = Table[RandomPolygon[{"Simple", i}], {i, n}];AllTrue[polygons, SimplePolygonQ]Time complexity for algorithms for simple polygons:
t = First[AbsoluteTiming[SimplePolygonQ[#]]]& /@ polygons;Show[{ListPlot[Transpose[{n, t}], PlotRange -> All, Joined -> True, AxesLabel -> {"n", "Time"}], Plot[Style[Evaluate[Fit[Transpose[{n, t}], {1, x}, x]], Red, Dashed], {x, 0, 10 ^ 5}]}]Polygon classification using machine learning. Train a classifier function on polygon examples:
trainingset = Table[(RandomPolygon[{#, RandomInteger[{3, 100}]}] -> #)&@RandomChoice[{"Simple", "Convex", "StarShaped"}], {20}];cfunc = Classify[Image[Graphics[#1]] -> #2&@@@trainingset]Use the classifier function to classify new polygons:
class = cfunc[Image[Graphics[#]]]&;𝒫 = DynamicModule[«3»];class[𝒫]𝒫 = DynamicModule[«3»];class[𝒫]𝒫 = DynamicModule[«3»];class[𝒫]Properties & Relations (5)
𝒫 = Polygon[{{0, 0}, {1, 0}, {0.5, 0.8}}]ConvexPolygonQ[𝒫]SimplePolygonQ[𝒫]The OuterPolygon of a simple polygon is simple:
𝒫 = Polygon[{{0, 0}, {1, 0}, {0.5, 0.8}}]SimplePolygonQ[𝒫]SimplePolygonQ[OuterPolygon[𝒫]]Simple polygons do not have holes:
InnerPolygon[𝒫]Use PolygonDecomposition to decompose a polygon into simple polygons:
𝒫 = Polygon[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {1, 2}, {2, 2}, {2, 1}}, {1, 2, 3, 4} -> {{5, 6, 7, 8}}];PolygonDecomposition[𝒫, "Simple"]Graphics[{EdgeForm[Gray], %}]Use RandomPolygon to generate a simple polygon:
RandomPolygon["Simple"]SimplePolygonQ[%]The number of edges of a simple polygon always equals the number of vertices:
𝒫 = DynamicModule[«3»];MeshCellCount[𝒫, 0] == MeshCellCount[𝒫, 1]Possible Issues (1)
For nonconstant polygons, SimplePolygonQ returns False:
𝒫 = Polygon[{{a, b}, {c, d}, {e, f}, {g, h}}];ConstantRegionQ[𝒫]SimplePolygonQ[𝒫]Related Guides
-
▪
- Polygons
History
Text
Wolfram Research (2019), SimplePolygonQ, Wolfram Language function, https://reference.wolfram.com/language/ref/SimplePolygonQ.html.
CMS
Wolfram Language. 2019. "SimplePolygonQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SimplePolygonQ.html.
APA
Wolfram Language. (2019). SimplePolygonQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SimplePolygonQ.html
BibTeX
@misc{reference.wolfram_2026_simplepolygonq, author="Wolfram Research", title="{SimplePolygonQ}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/SimplePolygonQ.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_simplepolygonq, organization={Wolfram Research}, title={SimplePolygonQ}, year={2019}, url={https://reference.wolfram.com/language/ref/SimplePolygonQ.html}, note=[Accessed: 13-June-2026]}