compactness
cellseg_gsontools.geometry.compactness(polygon, **kwargs)
¶
Compute the compactness of a polygon.
Note
Compactness is defined as the ratio of the area of an object to the area of a circle with the same perimeter. A circle is the most compact shape. Objects that are elliptical or have complicated, irregular (not smooth) boundaries have larger compactness. - Wirth
Compactness: $$ \frac{4\pi A_{poly}}{P_{poly}^2} $$
where \(A_{poly}\) is the area of the polygon 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 compactness value of a polygon between 0-1. |