Boost logo

Geometry :

Subject: Re: [geometry] intersects( polygon, box )
From: alzi (aZiegenhagel_at_[hidden])
Date: 2012-05-31 14:16:32


Barend wrote
>
> Hi,
>
> On 16-2-2012 18:30, Volker Schöch wrote:
>> Hi once more,
>> I have found the following problem:
>>
>> A = POLYGON((1992 3240,1992 1440,3792 1800,3792 3240))
>> B1 = Box(1941;2066;2055;2166) // wkt for box outputs a clockwise, closed
>> polygon which is confusing in this context
>> B2 = POLYGON((1941 2066,2055 2066,2055 2166,1941 2166)) // the same shape
>> as B1, but type polygon
>>
>> boost::geometry::intersects( A, B1 ) = false (wrong)
>> boost::geometry::intersects( A, B2 ) = true (correct)
>>
>> As always, I am using boost 1.48.0, my polygon type is oriented
>> counter-clockwise and not closed, my point type is based on int.
>
>
> Without trying, I think this is fixed in 1.49 too. There was one issue
> in intersects which was positively false (not intersecting) while it
> should have been true. This looks like your problem.
>

Hi,

I noticed this bug by myself some time ago and now tried the situation
described by Volker Schöch with 1.49 and trunk.
It seams not to be fixed yet.

I traced the bug to a problem in detail::disjoint::disjoint_linear where a
flag 'policy.has_intersections' is false, but a list that gets all turn
points has a size greater zero (what should be impossible in my opinion?!).
I did not dig any deeper into the problem but just changed the statement
'if(policy.has_intersection)' to 'if(boost::size(turns) > 0)' at line 122 in
boost/geometry/algorithm/disjoint.hpp.
I don't know whether this has any bad side effects but solved the problems I
was facing.

Regards,
Albert

--
View this message in context: http://boost-geometry.203548.n3.nabble.com/intersects-polygon-box-tp3751095p4024565.html
Sent from the Boost Geometry mailing list archive at Nabble.com.

Geometry list run by mateusz at loskot.net