ConvexPolygonQ

ConvexPolygonQ[poly]

gives True if the polygon poly is convex, and False otherwise.

Details

  • A polygon is convex if no line segment between two points in the polygon ever goes outside the polygon.
  • A convex polygon is visible from all points in the polygon.

Examples

open allclose all

Basic Examples  (2)

Test whether a polygon is convex:

ConvexPolygonQ gives False for non-convex polygons:

Scope  (7)

ConvexPolygonQ works on polygons:

Triangle:

Rectangle:

Polygon with holes:

Self-intersecting polygons:

Polygons with disconnected components:

Polygon in :

ConvexPolygonQ works on polygons of geographic entities:

Polygons with GeoPosition:

Polygons with GeoPositionXYZ:

Polygons with GeoPositionENU:

ConvexPolygonQ works on polygons with GeoGridPosition:

Applications  (4)

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

Time complexity for algorithms for convex polygons:

Test whether a polygon is concave:

Attempt to test whether a geometric region is convex:

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  (6)

A convex polygon is simple:

The OuterPolygon of a convex polygon is convex:

Convex polygons do not have inner polygons:

A convex polygon has all interior vertex angles less than :

Use PolygonDecomposition to decompose a polygon into convex polygons:

Use RandomPolygon to generate a convex polygon:

The convex polygon is the convex hull of its edges:

Possible Issues  (1)

For a nonconstant polygon, ConvexPolygonQ returns False:

Wolfram Research (2019), ConvexPolygonQ, Wolfram Language function, https://reference.wolfram.com/language/ref/ConvexPolygonQ.html.

Text

Wolfram Research (2019), ConvexPolygonQ, Wolfram Language function, https://reference.wolfram.com/language/ref/ConvexPolygonQ.html.

CMS

Wolfram Language. 2019. "ConvexPolygonQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ConvexPolygonQ.html.

APA

Wolfram Language. (2019). ConvexPolygonQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ConvexPolygonQ.html

BibTeX

@misc{reference.wolfram_2024_convexpolygonq, author="Wolfram Research", title="{ConvexPolygonQ}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/ConvexPolygonQ.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_convexpolygonq, organization={Wolfram Research}, title={ConvexPolygonQ}, year={2019}, url={https://reference.wolfram.com/language/ref/ConvexPolygonQ.html}, note=[Accessed: 21-November-2024 ]}