
Geometry : 
Subject: Re: [geometry] Difference problem using boost geometry in 1.47
From: Barend Gehrels (barend_at_[hidden])
Date: 20131026 05:54:13
Hi Dan,
Macumber, Daniel wrote On 25102013 23:50:
>
> I am using boost geometry in 1.47 and am pretty happy with it.
> However, I am having a problem performing an intersection that I can't
> figure out how to solve. When I difference two geometries, I am
> sometimes left with a result that uses reverse winding to subtract a
> piece of the result rather than providing a "clean" polygon with
> winding in one direction only. I've posted an image here that
> demonstrates this:
>
> http://oi42.tinypic.com/2elfp0o.jpg
>
> I get the feeling that if I were to use the right models this might
> somehow be fixed? If not is there an algorithm that can clean up the
> result? Here is the code I am using:
>
> typedef boost::geometry::model::d2::point_xy<double> BoostPoint;
>
> typedef boost::geometry::model::polygon<BoostPoint> BoostPolygon;
>
> typedef boost::geometry::model::ring<BoostPoint> BoostRing;
>
> BoostRing facePolygon;
>
> BoostRing otherFacePolygon;
>
> std::vector<BoostPolygon> faceDifferenceResult;
>
> ....
>
> boost::geometry::difference(facePolygon, otherFacePolygon,
> faceDifferenceResult);
>
>
This should be handled correctly. The usage seems good. Do you have them
clockwise ordered? You might call boost::geometry::correct first.
Do you have the coordinates (preferably WKT) of your input polygons? I
can then better check the case.
Thanks, Barend
Geometry list run by mateusz at loskot.net