is_polygon_convex

compas.geometry.is_polygon_convex(polygon)[source]

Determine if a polygon is convex.

Parameters

polygon (sequence[point] | compas.geometry.Polygon) – A polygon.

Returns

bool – True if the polygon is convex. False otherwise.

Notes

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

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