geometry icon indicating copy to clipboard operation
geometry copied to clipboard

is_convex for multi only looks at the first geometry

Open barendgehrels opened this issue 1 year ago • 1 comments

Commented with:

// TODO: this looks wrong, it should only return convex if all its rings are convex

barendgehrels avatar Apr 19 '23 17:04 barendgehrels

It depends on how we define is_convex. Some possible definitions:

  1. input equals its convex hull
  2. union of polygon parts of the multi-polygon is convex
  3. 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.

vissarion avatar Jun 19 '23 10:06 vissarion