c++ - 使用 boost::geometry::within 编译错误

标签 c++ boost boost-geometry

我正在尝试编译一个使用 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);

其中pointlegacy_point类型,conv_layerlegacy_point的 vector 。我可以使用 boost::geometry::distance 函数,但在内部出现上述错误。

最佳答案

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

查看帮助页面上的“Supported Geometries”表格,表格中multipoint&multipoint的交叉处有一个红色的大X。

enter image description here

关于c++ - 使用 boost::geometry::within 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54155286/

相关文章:

c++ - boost asio 绑定(bind) : bad file descriptor

c++ - 如何 boost Boost ASIO、UDP 客户端应用程序的吞吐量

c++ - K 均值聚类 R 树 boost

c++ - 按引用数组值交换

C++ 动态库 - 在 OS X 上运行时链接符号

c++ - 语言混合 : Model and View

c++ - 如何将 boost::geometry::rtree 与 glm::vec3 一起用作自定义点类型?

c++ - 预处理器和编译器之间的界限到底在哪里?

c++ - 如何将变换矩阵应用于 OpenCV 中的一个点?

c++ - 使用 Boost Geometry 进行多边形缓冲时结果不佳或不正确