【问题标题】:Constrained delaunay triangulation with Projection_traits_xy_3使用 Projection_traits_xy_3 进行约束 delaunay 三角剖分
【发布时间】:2015-11-24 16:23:18
【问题描述】:

如何将Constrained_Delaunay_triangulation_2 与 3d 数据一起使用?之后我需要显示一个网格。

根据文档,Projection_traits_xy_3ConstrainedTriangulationTraits_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;
}

【问题讨论】:

  • 在与三角测量相关的所有事情中用 Gt 替换 K
  • 如何使用迭代器构建 CDT? cdt(points.begin(), points.end())cdt.insert(Point(p)) 其中pPoint3 有效,但不适用于迭代器,它显然期望pair
  • 试试cdt.insert(points.begin(), points.end());
  • @sloriot 成功了。把你的cmets作为答案,我给你!

标签: c++ cgal


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-15
    • 1970-01-01
    • 1970-01-01
    • 2019-10-05
    • 1970-01-01
    • 2015-02-21
    • 2013-12-06
    • 2015-01-07
    相关资源
    最近更新 更多