convexity
cellseg_gsontools.geometry.convexity(polygon, **kwargs)
¶
Compute the convexity of a polygon.
Note
Convexity is the relative amount that an object differs from a convex object. Convexity is defined by computing the ratio of the perimeter of an object's convex hull to the perimeter of the object itself. This will take the value of 1 for a convex object, and will be less than 1 if the object is not convex, such as one having an irregular boundary. - Wirth
Convexity: $$ \frac{P_{convex}}{P_{poly}} $$
where \(P_{convex}\) is the perimeter of the convex hull and \(P_{poly}\) is the perimeter of the polygon.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
polygon |
Polygon
|
Input shapely polygon object. |
required |
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
The convexity value of a polygon between 0-1. |