- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
接着是:How to print the faces of a Voronoi diagram? ,我现在有:
#include <iostream>
#include <fstream>
#include <cassert>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Segment_Delaunay_graph_2.h>
#include <CGAL/Segment_Delaunay_graph_adaptation_policies_2.h>
#include <CGAL/Segment_Delaunay_graph_traits_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Segment_Delaunay_graph_traits_2<K> Gt;
typedef CGAL::Segment_Delaunay_graph_2<Gt> DT;
int main() {
std::ifstream ifs("data.cin");
assert( ifs );
DT vd;
DT::Site_2 site;
// read the sites from the stream and insert them in the diagram
while ( ifs >> site ) { vd.insert( site ); }
ifs.close();
// validate the diagram
assert( vd.is_valid(true, 1) );
std::cout << std::endl << std::endl;
// Iterate over edges
DT::Finite_edges_iterator eit = vd.finite_edges_begin();
for (int k = 1; eit != vd.finite_edges_end(); ++eit, ++k) {
DT::Edge e = *eit;
//std::cout << e << std::endl;
}
}
然而,不能简单地打印边缘(使用cout
)。怎么做?
这是另一次尝试的错误:
/home/gsamaras/CGAL-4.7/code/DelaunayTOvoronoi/delTovor.cpp:30:27: error: ‘CGAL::Triangulation_ds_edge_iterator_2<CGAL::Triangulation_data_structure_2<CGAL::Segment_Delaunay_graph_vertex_base_2<CGAL::Segment_Delaunay_graph_storage_traits_2<CGAL::Segment_Delaunay_graph_traits_2<CGAL::Epick> >, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Segment_Delaunay_graph_face_base_2<CGAL::Segment_Delaunay_graph_traits_2<CGAL::Epick>, CGAL::Triangulation_ds_face_base_2<void> > >, true>::Edge’ has no member named ‘site’
std::cout << eit->site() << std::endl;
^
最佳答案
您可以像这样打印形成边缘的站点:
for (int k = 1; eit != vd.finite_edges_end(); ++eit, ++k) {
DT::Edge e = *eit;
std::cout << "k = " << k << std::endl;
if ( vd.is_infinite(e.first->vertex( vd.ccw(e.second) )) )
std::cout << "infinite\n";
else
std::cout << e.first->vertex( vd.ccw(e.second) )->site() << std::endl;
if ( vd.is_infinite(e.first->vertex( vd.cw(e.second) )) )
std::cout << "infinite\n";
else
std::cout << e.first->vertex( vd.cw(e.second) )->site() << std::endl;
if ( vd.is_infinite(e.first->vertex( e.second )) )
std::cout << "infinite\n";
else
std::cout << e.first->vertex( e.second )->site() << std::endl;
if ( vd.is_infinite(vd.tds().mirror_vertex(e.first, e.second) ) )
std::cout << "infinite\n";
else
std::cout << vd.tds().mirror_vertex(e.first, e.second)->site() << std::endl;
}
关于c++ - 如何打印 Delaunay 图的边?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37447998/
我一直在寻找这个问题的答案,但找不到任何有用的东西。 我正在使用 python 科学计算堆栈(scipy、numpy、matplotlib)并且我有一组二维点,为此我使用 scipy.spatial.
我正在试验 scipy.spatial's implementation of Qhull's Delaunay triangulation . 是否有可能以保留输入顶点定义的边的方式生成三角剖分?
我在看这个视频:Delaunay Triangulation我想用它以相同的方式生成程序内容。我很难弄清楚如何使用 LibGDX 提供的 DelaunayTriangulation 类,但我想我终于弄
我正在使用三角剖分库来计算某个大边界内的一组矩形的约束 Delaunay 三角剖分。该算法返回所有边,但也在定义约束的矩形内添加边。 我希望能够创建一个没有任何作为约束的矩形内的边的图形(当然大边界除
我想对带孔的复杂(但不是自相交)多边形进行三角剖分,以便生成的三角形都位于多边形内,完全覆盖该多边形,并遵守 Delaunay 三角形规则。 显然,我可以为所有点构建 Delaunay 三角剖分,但我
我正在使用 Delaunay 对凹多边形进行三角剖分,但它填充了凹面。如何自动删除多边形边界之外的三角形? 最佳答案 自我回答:在某些情况下,这是不可能的。我需要使用受约束的 Delaunay 算法:
如何从 Delaunay 三角剖分中删除大于我需要的距离? 示例数据: x 0 i <- abs( i[ keep ] ) j <- abs( j[ keep ] ) plot( x, y ) seg
大多数迭代算法需要一个初始的空三角形来让球滚动。似乎一个常用的技巧就是将 super 三角形与点集相比变得非常大。 但根据“数值食谱:科学计算的艺术”: “...如果距离仅仅是有限的(到边界点),则构
MATLAB 在 their website 上声明: It is more efficient to edit a delaunayTriangulation to make minor modif
我使用 Matlab 2013 版进行了 Delaunay 三角剖分。我想删除一些三角形,这意味着取消它们的连接性,例如三角形编号 760。我该如何进行此更改?当我尝试编辑连接列表时: dt.Conn
给定点集的 Delaunay 三角剖分,我应该如何索引我的三角剖分以进行快速点定位? 我目前正在遍历所有三角形。对于每个三角形,我正在检查给定点是否在三角形的边界矩形内。如果是,我会使用几何方程检查三
我已经绘制了 n 个随机点 (黑点) 并使用了 delaunay 三角剖分,现在我想插入 m 个随机评估点 (红色点) 所以我需要计算评估点在哪个三角形内。 计算每个点的三角形顶点的方法是什么? 最佳
给定有线表示中的网格的 delaunay 三角剖分,我会喜欢显示没有对角线的表面,我只是想想象一个整洁的正方形。是否有任何选项可以完成此操作,也许是过滤器? 有点像 delaunay->Boundin
在 MATLAB 中,我加载了以下点云: load tetmesh 这会将 X 和 tet 加载到工作区中。因此,我执行了一个散点图,结果如下所示: scatter3(X(:,1), X(:,2),
我有一个具有 V 个顶点和 n 个开口的多边形。如何在 MATLAB 中使用 Delaunay 三角剖分为此多边形创建网格? 我知道我可以使用 delaunay功能,但我不知道如何输入开口。 最佳答案
我想根据二维平面上一组点之间的欧式距离计算最小生成树。我当前的代码存储所有边,然后执行 Prim 算法以获得最小生成树。但是,我知道这样做会占用所有边的 O(n^2) 空间。 在做了一些研究之后,很明
接着是:How to print the faces of a Voronoi diagram? ,我现在有: #include #include #include #include #inc
我刚刚完成了 Delaunay 增量翻转算法的实现。该算法的时间复杂度为 O(N log N)。 该算法的应用是基于将每个点作为电话公司的天线。使用 Delaunay 算法,我必须用这些点对空间进行三
我有一组多边形,它们可能共享公共(public)边和节点。所有这些多边形都是严格不重叠的,尽管它们可以共享一个公共(public)顶点或边。 我想批量对所有这些多边形进行三角剖分,因此,我能想到的解决
我已经实现了 Domiter 和 Zalik 使用的扫描线方法,以在 Java 中为二维空间中的一组点生成受约束的 Delaunay 三角剖分。我想确保我开发的代码真正适用于 n 个随机生成的点和它们
我是一名优秀的程序员,十分优秀!