SimplePolygonQ

SimplePolygonQ[poly]

gives True if the polygon poly is simple and False otherwise.

Details

  • A polygon is simple if it has no holes and non-intersecting boundary line segments.
  • A simple polygon is topologically equivalent to a disk.

Examples

open allclose all

Basic Examples  (2)

Test whether a polygon is simple:

SimplePolygonQ gives False for non-simple polygons:

Scope  (5)

SimplePolygonQ works on polygons:

Triangle:

Rectangle:

Polygon with holes:

Self-intersecting polygons:

Polygons with disconnected components:

Polygons in :

Applications  (2)

Generate random polygons for testing algorithms and verification of time complexity:

Time complexity for algorithms for simple polygons:

Polygon classification using machine learning. Train a classifier function on polygon examples:

Use the classifier function to classify new polygons:

A simple polygon:

A starshaped polygon:

Properties & Relations  (5)

A convex polygon is simple:

The OuterPolygon of a simple polygon is simple:

Simple polygons do not have holes:

Use PolygonDecomposition to decompose a polygon into simple polygons:

Use RandomPolygon to generate a simple polygon:

The number of edges of a simple polygon always equals the number of vertices:

Possible Issues  (1)

For nonconstant polygons, SimplePolygonQ returns False:

Introduced in 2019
 (12.0)