2016-08-15 7 views
0

ノードの束とそれらの接続性を持つ紙面に三角形のメッシュを書きました。私は明らかにポイントポイントとセルを使って手動でメッシュをCGALに挿入

の挿入を可能にする Mesh_2/mesh_optimization.cpp で探しています

を、に、CGALにこのメッシュを入れたい例えば、ロイドは平滑で遊んで、ボロノイ図などを計算したいです

CDT cdt; 
Vertex_handle va = cdt.insert(Point(-2,0)); 
Vertex_handle vb = cdt.insert(Point(0,-2)); 
Vertex_handle vc = cdt.insert(Point(2,0)); 
Vertex_handle vd = cdt.insert(Point(0,1)); 

しかし、細胞(三角形)はありません。

どこから始めるべきですか?

答えて

1

私は同様の状況に遭遇しました。警告:私はこれらの特定のアルゴリズムを使用する必要はありませんでした。そのため、このソリューションがどのように動作するのかよく分かりません。

CGAL::Triangulation_data_structure_2wiki)を使用して、フェイス、ネイバー、および頂点を手動で指定できます。

//insert vertex 
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; 
typedef K::Point_3 Point_3; 
typedef CGAL::Projection_traits_xy_3<K> Gt; //allows for using 2D algorithms on the 3D points 
typedef ex_vertex<Gt> Vb; //custom vertex class 
typedef face<Gt> Fb; //custom face class, use default face and vertex as required 
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> triangulation; 

triangulation tri; 
//read in x,y from a file here 
//create a new vertex 
Point_2 pt(x,y); 
Vertex_handle Vh = tri->create_vertex(); 
Vh->set_point(pt); 

は、あなたがこれを数回やったと仮定して、あなたの三角測量では、様々な頂点にハンドルを持っている:

auto face = tri->create_face(vert1,vert2,vert3); 

、あなたは1つの以上の顔を持っている場合、あなたは顔ネイバーを設定することができます

face->set_neighbors(face0,face1,face2); 
関連する問題