geometry
geometry copied to clipboard
is_convex for multi only looks at the first geometry
Commented with:
// TODO: this looks wrong, it should only return convex if all its rings are convex
It depends on how we define is_convex
. Some possible definitions:
- input equals its convex hull
- union of polygon parts of the multi-polygon is convex
- each polygon of the multi polygon is convex
To my understanding the most natural definition is 1. In such a case the current implementation seems correct.
For 2 the user can call union and then is_convex
and for 3 the user can iterate over all polygons of a multipolygon and apply is_convex
.
What is missing is a documentation for is_convex
where we should mention the definition that we choose so that the user (or the contributor) knows what to expect for such a function.