使用boost :: geometry :: within

时间:2019-01-11 23:20:11

标签: c++ boost boost-geometry

我正在尝试编译使用boost :: geometry :: within的程序,但出现以下错误:

  

/usr/include/boost/geometry/algorithms/within.hpp:在实例化中   ‘bool boost :: geometry :: within(const Geometry1&,const Geometry2&)   [使用Geometry1 = legacy_point;几何2 =   std :: vector]’:glcanvas.cpp:1460:57:从此处开始   /usr/include/boost/geometry/algorithms/within.hpp:295:55:错误:   “ apply”不是以下成员   ‘boost :: geometry :: dispatch :: inside,boost :: geometry :: point_tag,   boost :: geometry :: multi_point_tag>

我的几何定义如下:

struct legacy_point{
float x, y, z;
};

BOOST_GEOMETRY_REGISTER_POINT_3D(legacy_point, float, cs::cartesian, x, y, z)
BOOST_GEOMETRY_REGISTER_MULTI_POINT(decltype(std::vector< legacy_point>{}))

我正在调用以下函数:

boost::geometry::within(point, conv_layer);

其中pointlegacy_point类型,而conv_layerlegacy_point的向量。我可以使用boost :: geometry :: distance函数,但会在内部得到上述错误。

1 个答案:

答案 0 :(得分:1)

看来boost::geometry::within不支持检查multipoint是否在multipoint内。

请参阅帮助页面上的“支持的几何图形”表,该表的多点与多点相交处有一个红色的大X。

enter image description here