我正在尝试编译一个使用 boost::geometry::within 的程序,但出现以下错误:
/usr/include/boost/geometry/algorithms/within.hpp: In instantiation of ‘bool boost::geometry::within(const Geometry1&, const Geometry2&) [with Geometry1 = legacy_point; Geometry2 = std::vector]’: glcanvas.cpp:1460:57: required from here /usr/include/boost/geometry/algorithms/within.hpp:295:55: error: ‘apply’ is not a member of ‘boost::geometry::dispatch::within, 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);
其中point
是legacy_point
类型,conv_layer
是legacy_point
的 vector 。我可以使用 boost::geometry::distance 函数,但在内部出现上述错误。
最佳答案
看来 boost::geometry::within
不支持检查 multipoint
是否在 multipoint
内。
查看帮助页面上的“Supported Geometries”表格,表格中multipoint&multipoint的交叉处有一个红色的大X。
关于c++ - 使用 boost::geometry::within 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54155286/