Boost logo

Geometry :

Subject: [geometry] boost::geometry::difference problem
From: h2 (account.h.horiuchi_at_[hidden])
Date: 2012-09-14 09:54:31


Hi.

I am troubled by funny behavior of boost::geometry::difference.
Two cases below should be the same, but a different result comes back.

*OK
geometry1 MULTIPOLYGON(((-2 5, -1 5, 0 5, 2 5, 2 -2, 1 -2, 1 -1, 0 -1,
0 0, -1 0, -2 0, -2 5)))
geometry2 MULTIPOLYGON(((0 0, 1 0, 1 -1, 0 -1, 0 0)), ((-1 5, 0 5, 0
0, -1 0, -1 5)))
output MULTIPOLYGON(((0.0 5.0,2.0 5.0,2.0 -2.0,1.0 -2.0,1.0 -1.0,1.0
0.0,0.0 0.0,0.0 5.0)),((-1.0 5.0,-1.0 0.0,-2.0 0.0,-2.0 5.0,-1.0
5.0)))

*NG
geometry1 MULTIPOLYGON(((-2 5, -1 5, 0 5, 2 5, 2 -2, 1 -2, 1 -1, 0 -1,
0 0, -1 0, -2 0, -2 5)))
geometry2 MULTIPOLYGON(((-1 5, 0 5, 0 0, -1 0, -1 5)), ((0 0, 1 0, 1
-1, 0 -1, 0 0)))
output MULTIPOLYGON(((-1.0 5.0,-1.0 0.0,-2.0 0.0,-2.0 5.0,-1.0 5.0)))

As for the difference of both, polygon order of geometry2 is only reversed.

I traced a program,
Was found to be a pattern that is not supported by
boost::geometry::detail::overlay::sort_in_cluster::operator().
(geometry/algorithms/detail/overlay/handle_tangencies.hpp)

The pattern that developed is "ix/xi".

Will you know a correspondence method for this behavior?
If there is advice, I am happy,
and sorry for my english (not a native speaker. Therefore, I'm using a
language translation service google.)

Best Regards.
h2


Geometry list run by mateusz at loskot.net