WOLFRAM

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)Summary of the most common use cases

Test whether a polygon is convex:

Out[1]=1
Out[2]=2

ConvexPolygonQ gives False for non-convex polygons:

Out[1]=1
Out[2]=2

Scope  (7)Survey of the scope of standard use cases

ConvexPolygonQ works on polygons:

Out[1]=1
Out[2]=2

Triangle:

Out[3]=3

Rectangle:

Out[4]=4

Polygon with holes:

Out[1]=1
Out[2]=2

Self-intersecting polygons:

Out[1]=1
Out[2]=2

Polygons with disconnected components:

Out[1]=1
Out[2]=2

Polygon in :

Out[2]=2

ConvexPolygonQ works on polygons of geographic entities:

Out[2]=2

Polygons with GeoPosition:

Out[4]=4

Polygons with GeoPositionXYZ:

Out[6]=6

Polygons with GeoPositionENU:

Out[8]=8

ConvexPolygonQ works on polygons with GeoGridPosition:

Out[2]=2

Applications  (4)Sample problems that can be solved with this function

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

Out[13]=13

Time complexity for algorithms for convex polygons:

Out[15]=15

Test whether a polygon is concave:

Out[2]=2
Out[3]=3

Attempt to test whether a geometric region is convex:

Out[2]=2
Out[3]=3

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

Out[2]=2

Use the classifier function to classify new polygons:

Out[5]=5
Out[6]=6

A simple polygon:

Out[8]=8

A starshaped polygon:

Out[10]=10

Properties & Relations  (6)Properties of the function, and connections to other functions

A convex polygon is simple:

Out[1]=1
Out[2]=2
Out[3]=3

The OuterPolygon of a convex polygon is convex:

Out[1]=1
Out[2]=2
Out[3]=3

Convex polygons do not have inner polygons:

Out[4]=4

A convex polygon has all interior vertex angles less than :

Out[1]=1
Out[2]=2

Use PolygonDecomposition to decompose a polygon into convex polygons:

Out[2]=2
Out[3]=3

Use RandomPolygon to generate a convex polygon:

Out[1]=1
Out[2]=2

The convex polygon is the convex hull of its edges:

Out[2]=2

Possible Issues  (1)Common pitfalls and unexpected behavior

For a nonconstant polygon, ConvexPolygonQ returns False:

Out[2]=2
Out[3]=3
Wolfram Research (2019), ConvexPolygonQ, Wolfram Language function, https://reference.wolfram.com/language/ref/ConvexPolygonQ.html.
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.

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.

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

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

BibTeX

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

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

BibLaTeX

@online{reference.wolfram_2025_convexpolygonq, organization={Wolfram Research}, title={ConvexPolygonQ}, year={2019}, url={https://reference.wolfram.com/language/ref/ConvexPolygonQ.html}, note=[Accessed: 23-April-2025 ]}

@online{reference.wolfram_2025_convexpolygonq, organization={Wolfram Research}, title={ConvexPolygonQ}, year={2019}, url={https://reference.wolfram.com/language/ref/ConvexPolygonQ.html}, note=[Accessed: 23-April-2025 ]}