Question

I am trying to calculate the overlap area between two ellipses. I am approximating the ellipses with polygons now and I have found an example that apparently used an old version of Boost.Geometry, as per this answer. From the second answer to this question, I can see that this is an old example as well, since some of the header files are not there in v1.53. I have replaced those with:

#include <boost/geometry/geometries/adapted/c_array.hpp>
#include <boost/geometry/multi/multi.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>

and also added this code:

typedef boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian> point_2d;
typedef boost::geometry::model::polygon<point_2d> polygon_2d;

and almost everything works. The only problem is with this:

polygon_2d poly, poly2;   
typedef std::vector<polygon_2d > polygon_list;
polygon_list v;
intersection_inserter<polygon_2d >(poly2, poly, std::back_inserter(v));

I am getting an error:

intersection_inserter was not declared in this scope
expected primary expression before '>' token

The documentation of boost on the matter here is from 2009, so I guess it does not apply anymore... Their example is written the same as mine, as far as I can tell. I have found the place on the header file intersection.hpp where intersection_inserter is defined but I cannot make heads or tails of it...

I am getting the same error both in VS2012 in win7 and Qt 4.7.4 in Linux Mint 14. Any help would be greatly appreciated!

Was it helpful?

Solution

I cannot find any reference to intersection_inserter in the current boost documentation. Perhaps this functionality has been removed?

It seems that the "official" way to calculate intersections in boost::geometry is through the intersection function, as documented (with example) here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top