is_polygon_convex

compas.geometry.is_polygon_convex(polygon)[source]

Determine if a polygon is convex.

Parameters

polygon (list of points or compas.geometry.Polygon) – A polygon.

Notes

Use this function for spatial polygons. If the polygon is in a horizontal plane, use is_polygon_convex_xy() instead.

Returns

boolTrue if the polygon is convex. False otherwise.

Examples

>>> polygon = [[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.4, 0.4, 0.0], [0.0, 1.0, 0.0]]
>>> is_polygon_convex(polygon)
False