Retrieve z from a constrained delaunay triangulation of Projection_traits_xy_3

做~自己de王妃 提交于 2021-01-28 07:08:03

问题


Given x,y, how can I retrieve the z coordinate of a 2D constrained delaunay triangulation built from 2.5D with projection_traits_xy_3?

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Projection_traits_xy_3<K>  Gt;

typedef CGAL::Triangulation_vertex_base_2<Gt> Vb;
typedef CGAL::Delaunay_mesh_face_base_2<Gt> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;
typedef CGAL::Constrained_Delaunay_triangulation_2<Gt, Tds> CDT;

My guess is that I have to retrieve the face, but what would be the next step?

CDT::Point query(10,10,?);   
CDT::Face_handle face_handle = cdt.locate(query);

回答1:


Triangulation::Point will be a 3D point, so face_handle->vertex(0)->point() will be a 3D point with a z-coordinate.




回答2:


As @Andreas pointed out, the triangulation stores 3d points even if it uses its 2d projection. Therefore, we can retrieve the Point_3.

Given the query point (x,y) = (100,100):

//z unknown
Point query1(100, 100, 0);

CDT::Face_handle face_handle = cdt.locate(query1);

K::Point_3 p = face_handle->vertex(0)->point();
K::Point_3 q = face_handle->vertex(1)->point();
K::Point_3 r = face_handle->vertex(2)->point();


来源:https://stackoverflow.com/questions/33891713/retrieve-z-from-a-constrained-delaunay-triangulation-of-projection-traits-xy-3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!