Boost logo

Boost Users :

Subject: [Boost-users] [geometry] Difference problem using boost geometry in 1.47
From: Macumber, Daniel (Daniel.Macumber_at_[hidden])
Date: 2013-10-25 17:47:02


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);

Any ideas are much appreciated,
thanks a lot,
Dan



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net