Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Need help on Constrained Delaunay Triangulation

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Need help on Constrained Delaunay Triangulation


Chronological Thread 
  • From: Manuel Caroli <>
  • To:
  • Subject: Re: [cgal-discuss] Need help on Constrained Delaunay Triangulation
  • Date: Fri, 19 Feb 2010 21:41:37 +0100

Hi Thomas,

thomasyoung wrote:
HI,
I have such a problem: There is one closed 2D area (no hole) with boundary
specified by a closed curve (defined with vertices and edges). There are
also some vertices falling inside the curve (I am sure about this).
I am creating a triangular mesh inside the area. So I am trying to use
Constrained Delaunay Triangulation in CGAL.

First I define some types as example did:

typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> TDS;
typedef CGAL::Exact_predicates_tag Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> CDT;
typedef CDT::Point Point;
CDT cdt;

Then I insert all points: std::vector<CDT::Vertex_handle > vhandler;
while (it != list.end()) {
vhandler.push_back(cdt.insert(Point((*it)[0], (*it)[1])));
it++;
}

Now I want to know the vertices of each triangle face so I can write them
into obj file. That is, for each triangle face, I need to get the index of
all vertices, say, a triangle consists of 1st, 10th and 15th vertices.
From a Face_handle f you can access the points with f->vertex(i)->point(), where i is the index of the vertex in the face (i.e. 0, 1, or 2).
The triangulation data structure does not maintain indices for the vertices. If you need to index all your vertices you have to do put the index as an additional information in the vertices, see the documentation of Triangulation_vertex_base_with_info_2 and the "Adding colors" example in the Triangulation_2 User manual.

But I can't find the correct way to do this. If you have any sample code
piece, please help me. I really appreciate that.
hope this helps.

best

Manuel



Archive powered by MHonArc 2.6.16.

Top of Page