Boost logo

Geometry :

Subject: [geometry] multiple polygon difference
From: Stefan Wörthmüller (stefanwoe_at_[hidden])
Date: 2013-10-30 07:09:04

Hello i am currently struggling with the process of subtracting small polygons from a larger polygon. None of the polygons have holes and all small polygones are completely covered by the larger polygone. Of course, the result will be a polygon with holes. I first tried with boost 1.48, but as this resulted in compilation errors i now upgradet to 1.54 as i read in the release notes of 1.54: >    support for line/polygon intersections and differences. My code looks like this: typedef boost::geometry::model::d2::point_xy<double> boost_pnt; typedef boost::geometry::model::polygon<boost_pnt>   boost_poly; boost_poly outputPoly = outerPolygon; for(...) {     boost_poly innerPoly = ...;     boost_poly new_output;     boost::geometry::difference(outputPoly, innerPoly, new_output); outputPoly = new_output; } Compiling thjs with VC2010 results in the line of difference >D:\Develop\boost\boost_1_54_0\boost/range/iterator.hpp(63): error C2039: 'type' : is not a member of 'boost::mpl::eval_if_c<C,F1,F2>' 1>          with 1>          [ 1>              C=false, 1>              F1=boost::range_const_iterator<boost::geometry::model::polygon<boost_pnt>>, 1>              F2=boost::range_mutable_iterator<boost_poly> 1>          ] etc. So my understanding is, that difference() does not work with all parameters of type polygon. When using std::vector<boost_poly> as last parameter, difference compiles and works, but i see no way of converting this back to a polygon. I can not find a way to to distance in a loop. Is there some way to solve this problem? Regards, Stefan

Geometry list run by mateusz at