带Projection_traits_xy_3的约束Delaunay三角剖分 [英] Constrained delaunay triangulation with Projection_traits_xy_3

查看:95
本文介绍了带Projection_traits_xy_3的约束Delaunay三角剖分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何对3d数据使用 Constrained_Delaunay_triangulation_2 ?之后,我需要显示一个网格.

How can I use the Constrained_Delaunay_triangulation_2 with the 3d data? I need to display a mesh afterwards.

在文档中, Projection_traits_xy_3 ConstrainedTriangulationTraits_2 的模型.如何正确键入CDT?

From the docs, Projection_traits_xy_3 is a model of ConstrainedTriangulationTraits_2. How do I typedef the CDT correctly?

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;
}

推荐答案

所有三角剖分类的特征类参数必须为 Gt .约束三角剖分的按范围插入构造函数需要一定范围的约束.您可以改为使用插入功能.

The traits class parameters of all triangulation classes must be Gt. The insert-by-range constructor of the Constrained triangulation expects a range of constraints. You can use the insert function instead.

这篇关于带Projection_traits_xy_3的约束Delaunay三角剖分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆