如何将Constrained_Delaunay_triangulation_2
与3d数据一起使用?之后我需要显示一个网格。
从文档中,Projection_traits_xy_3
是ConstrainedTriangulationTraits_2
的模型。如何正确键入CDT?
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Projection_traits_xy_3<K> Gt;
typedef K::Point_3 Point;
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Delaunay_mesh_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, Tds> CDT;
//-or-
typedef CGAL::Constrained_Delaunay_triangulation_2<Gt, K, Tds> CDT;
//-or what?-
typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Criteria;
typedef CGAL::Delaunay_mesher_2<CDT, Criteria> Mesher;
typedef CDT::Vertex_handle Vertex_handle;
//what should Point be?
//typedef CDT::Point Point;
int main(int argc, char *argv[])
{
const char* fname = (argc>1)?argv[1]:"../sampledata/dtm_ground.xyz";
std::vector<Point> points;
std::ifstream stream(fname);
if (!stream || !CGAL::read_xyz_points(stream,
std::back_inserter(points),
CGAL::Identity_property_map<Point>()))
{
std::cerr << "Error: cannot read file " << fname << std::endl;
return EXIT_FAILURE;
}
CDT cdt(points.begin(), points.end());
//CGAL::refine_Delaunay_mesh_2(cdt, Criteria(0.125, 0.5));
//std::cout << "Number of vertices: " << cdt.number_of_vertices() << std::endl;
return EXIT_SUCCESS;
}
答案 0 :(得分:0)
所有三角测量类的traits类参数必须为Gt
。
Constrained三角剖分的逐个范围构造函数需要一系列约束。您可以改用插入函数。