Geometry :

Subject: Re: [geometry] intersection of two rings
From: Barend Gehrels (barend_at_[hidden])
Date: 2016-04-10 12:28:19

Hi Tobias,

Op 6-4-2016 om 10:53 schreef Ollmann, Tobias:
> First of all, thank you for developing this great library. I found it last week and it solved some of my problems at once :)

Thanks, good to hear that!

>
> But now I have a problem when calculating the intersection points of two linear rings.
> The rings share a common line which yields two intersection points while it should only give one (in my opinion)
>
> The two rings are:
> 0,10 - 0,30 - 30,30 - 30,10 ( - 0,10)
> 10,10 - 10,20 - 40,20 - 40,0 - 20,0 - 20,10 ( - 10,10)
>
> The found intersections are:
> 30,20
> 20,10
> 10,10
>
> Is this a bug or expected behavior?
> I would expect that the number of intersections of two closed rings is always even, as one ring has to 'enter' the other as often as it 'leaves' it.

It is expected behaviour. A shared egde will result into two separate
intersection points. So the number is not always even. Also, when one
polygon touches another in one point, the number of points is not even
(one, of course).

Regards, Barend

Geometry list run by mateusz at loskot.net