c++ - 给定一组点,使用 voroni 近似将空间分割成多边形区域

标签 c++ boost voronoi boost-polygon

我正在尝试将一个空间划分为一组多边形,其中每个多边形大约是一组输入点中的一个的 voroni 元胞。

我试图为此目的使用 Boost::Voroni,但是使用这个库的输出很复杂,需要很多额外的努力才能得到我想要的。

我想知道是否有人知道从 BOOST::voroni 图表中获取我想要的内容的最佳方法,或者是否有人知道一个比直接获取我正在寻找的内容更简单的库?

这里有一些代码展示了我正在尝试做的事情,

voronoi_diagram< float > vd;
construct_voronoi( gridPointPos.begin(), gridPointPos.end(), &vd );

int index = 0;
for (voronoi_diagram<float>::const_cell_iterator it = vd.cells().begin();
    it != vd.cells().end(); ++it, ++index ) {

    // if the voroni cell has infinite edges,
        // then clip them to a finite length

    // extract the voroni vertices of this cell

    // create a boost polygon from the extracted edges
} 

因为 boost 对于我的需求来说过于笼统和复杂,所以我更喜欢一个库或算法来简单地完成所有这些,只返回多边形集。我有哪些选择?

最佳答案

您可以尝试我在 PHP 中实现的用于 delaunay 三角剖分的 bowyer-watson 增量算法,它还可以找到 voronoi 图。您可以在 codeplex.com ( http://voronoi.codeplex.com/ ) 下载它。

关于c++ - 给定一组点,使用 voroni 近似将空间分割成多边形区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30881372/

相关文章:

C++ Armadillo : Get the ranks of the elements in a vector

c++ - 变量返回类型

r - 如何根据R中的曼哈顿距离计算Voronoi镶嵌

c++ - 使用固定内核进行多次迭代的膨胀/腐 eclipse 是否类似于具有更大尺寸的等效内核的膨胀/腐 eclipse

c++ - 合并来自kinect的rgb和深度图像

Go 中类似 C++ 模板的行为

c++ - CGAL 维诺图度量

windows - 在 Windows : substitute for Boost Pro? 上安装 Boost > 1.51

c++ - lapacke 与 boost 冲突?

c - voronoi 图不正确