Boost logo

Geometry :

Subject: Re: [geometry] within(Poly, Poly)
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-09-25 17:59:01


On 25-9-2013 22:56, Mateusz Loskot wrote:
> On 25 September 2013 19:34, Adam Wulkiewicz <adam.wulkiewicz_at_[hidden]> wrote:
>>
>> What do think we should do with self-intersecting polygons? This is slightly modified traverse_intersection_52:
>>
>>
>>
>> Is the blue polygon within the green one?
> According to OGC specification, the result is undefined.
> In other words: self-intersecting polygons are not valid and therefore
> their spatial relation can not be determined.
>
> There was somewhat related discussion, see the thread
> "[ggl] is_simple is_valid" started by Barend:
> http://lists.boost.org/geometry/2009/10/index.php

Ha, did not remember that, thanks.

I agree, polygons self-intersecting like in Adam's picture will result
in non-defined behaviour. By design we check validity not beforehand,
before each operation. We check it afterwards if the intersection fails,
one of the reasons to do that was, if I remember correctly, to report it
to the user. Also to avoid lots of reports of failing intersections...

Besides validity on self-crossings, we could consider if spikes can be
handled correctly, there are several cases with this. Sometimes also
still generated by our library (we have to consider that separately),
but they might be solveable.

Regards, Barend


Geometry list run by mateusz at loskot.net