Intersection_inserter没有在这个作用域中声明

Intersection_inserter was not declared in this scope

本文关键字:作用域 声明 inserter Intersection      更新时间:2023-10-16

我正在尝试计算两个椭圆之间的重叠区域。我现在用多边形近似椭圆,我已经找到了一个例子,显然使用了旧版本的Boost.Geometry,根据这个答案。从这个问题的第二个答案中,我可以看出这也是一个旧的例子,因为一些头文件在v1.53中不存在。我已经将它们替换为:

#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>

,还添加了以下代码:

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

和几乎所有的工作。唯一的问题是:

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

我得到一个错误:

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

关于这个问题的boost文档是从2009年开始的,所以我想它不再适用了…据我所知,他们的例子和我的一样。我已经找到了在头文件intersection.hpp中定义了intersection_inserter的地方,但我不能使它的头或尾…

我在win7的VS2012和Linux Mint 14的Qt 4.7.4中都得到了相同的错误。任何帮助将非常感激!

我在当前的boost文档中找不到intersection_inserter的任何参考。也许这个功能已经被删除了?

似乎boost::geometry中计算交叉点的"官方"方法是通过intersection函数,如这里记录的(带有示例)