Boost logo

Geometry :

Subject: Re: [geometry] overlay_invalid_input_exception in 1.50
From: Barend Gehrels (barend_at_[hidden])
Date: 2012-08-31 05:16:53


Hi,

Welcome to the list!

On 31-8-2012 11:09, V wrote:
> Hello world
>
> I encounter a overlay_invalid_input_exception while using the
> boost::geometry::intersection(p1,p2,out)
>
> I don't get why it works with some polygons and not with other, any help
> would be very welcome
>
> this work :
> str1 : POLYGON((530 -6890, 3530 -6890, 3680 -8240, 530 -6890))
> str2 : POLYGON((6926 1523, 5926 -10976, 8426 -3476, -4073 -10976, 3426
> -5976, -4073 -976, 6926 1523))
>
> and not this :
> str1 : POLYGON((4280 160, 5930 1810, 6980 1510, 6980 -4490, 5930 -7640, 4280
> -7490, 4280 160))
> str2 : POLYGON((6926 1523, 5926 -10976, 8426 -3476, -4073 -10976, 3426
> -5976, -4073 -976, 6926 1523))
>
> The read_wkt(str1,p1) et (str2,p2) get the right polygon each time.
> The intersection(p1,p2,out) crashes only in the second case.
>

It does not crash but reports an exception.

Your second polygon POLYGON((6926 1523, 5926 -10976, 8426 -3476, -4073
-10976, 3426 -5976, -4073 -976, 6926 1523)) is self-intersecting:

The first intersection with this invalid polygon succeeds, because it
probably happens to intersect it in a non-intersecting piece of it.
Boost.Geometry does not checks self-intersectons before the process (for
performance reasons). However, the second intersectoin is problematic,
and then the polygons are checked on validity.

Regards, Barend



habjceca.png

Geometry list run by mateusz at loskot.net