2016-08-15 1 views
0

노드의 무리와 연결성이있는 종이에 삼각형 메쉬가 적혀 있습니다. 나는 그림 등 보로 노이 컴퓨팅,,,에, CGAL에이 메시의 예를 넣어 로이드 다듬기 함께 놀러 싶습니다점과 셀이있는 메시를 수동으로 CGAL에 삽입하십시오.

분명히 포인트의 삽입을 허용

내가 Mesh_2/mesh_optimization.cpp 찾고 있어요

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_2 (wiki)을 사용하여 얼굴, 이웃 및 정점을 수동으로 지정할 수 있습니다.

//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); 
관련 문제