文章目录
- 声明
- delaunay三角片的特性
- 实现delaunay算法的分类
- 生长算法
- 逐点插入算法
- 分治算法
- 基于Bowyer-Watson算法
- code
- 调用scipy的API
- 调用cgal的API
- 参考来源
声明
- 本帖持续更新中
- 最近一次更新日期:2023.11.13
- 如有纰漏望指正!
delaunay三角片的特性
delaunay三角网是满足delaunay特性的三角剖分,在二维平面上满足两个特性:
(1)最小内角最大化;
(2)最大外接圆最小化;
在三维空间中,对三维点集的剖分又叫做delaunay四面体剖分,由于四面体的内角和不定,所以只满足最大外接球最小化这个特性。
实现delaunay算法的分类
生长算法
逐点插入算法
分治算法
基于Bowyer-Watson算法
code
调用scipy的API
pts=np.array([[1, 0, 0],
[1, 0, 1],
[0, 0, 0],
[1, 1, 1],
[0, 1, 0],
[0, 0, 1]])
tri = Delaunay(pts)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection='3d')
ax.plot_trisurf(pts[:,0], pts[:,1], pts[:,2], triangles=tri.simplices, cmap=plt.cm.Spectral)
plt.show()
调用cgal的API
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Triangulation_vertex_base_with_info_2<unsigned int, Kernel> Vb;
typedef CGAL::Triangulation_data_structure_2<Vb> Tds;
typedef CGAL::Delaunay_triangulation_2<Kernel, Tds> Delaunay;
typedef Kernel::Point_2 Point;
using namespace std;int main(vector<vector<float>>& pts){vector< pair<Point,unsigned> > points;points.push_back( make_pair( Point(-0.0177396,0.0642294), 0 ) );points.push_back( make_pair( Point(-0.0177283,0.0627822), 1 ) );points.push_back( make_pair( Point(-0.018731 ,0.0627665 ), 2 ) );points.push_back( make_pair( Point(-0.0187526,0.0641914), 3 ) );points.push_back( make_pair( Point(-0.0147168,0.0628748), 4 ) );points.push_back( make_pair( Point(-0.0157188,0.0628375), 5 ) );points.push_back( make_pair( Point(-0.0147222,0.0643235), 6 ) );points.push_back( make_pair( Point(-0.0157228,0.0642918), 7 ) );points.push_back( make_pair( Point(-0.0167333,0.0642714), 8 ) );points.push_back( make_pair( Point(-0.0177346,0.065722 ), 9 ) );points.push_back( make_pair( Point(-0.0187399,0.0656914), 10 ) );points.push_back( make_pair( Point(-0.0177409,0.0671746), 11 ) );points.push_back( make_pair( Point(-0.0187525,0.0671388), 12 ) );Delaunay triangulation;triangulation.insert(points.begin(),points.end());for(Delaunay::Finite_faces_iterator fit = triangulation.finite_faces_begin();fit != triangulation.finite_faces_end(); ++fit) {Delaunay::Face_handle face = fit;cout << face->vertex(0)->info()<<" "<< face->vertex(1)->info()<<" "<< face->vertex(2)->info() << endl;}
}
参考来源
[1] 知乎1
[2] 关于cloudcompare软件里面delaunay三角化的解释
[3] 原理
[4] 获取边表:靠谱:edgeTable、 边表原理