Subject: CGAL users discussion list
List archive
- From: <>
- To:
- Subject: [cgal-discuss] Access vertices of faces in Delaunay Triangulation
- Date: Sun, 15 Feb 2009 17:06:32 +0100 (CET)
Hello,
i'm relatively new to CGAL so it might be a stupid question but i've tried to
check the manual and forums before posting this one here.
I have a file with 3D-points (terrain). I want to create an 2D Delaunay
Triangulation and then save the faces / vertices that form the faces in an
file
or list.
More specific i would like to know the number (position in list) of the vertex
that forms a face.
Assuming i would have a list of three points the face would be formed by point
1, 2 and 3. Each point may have different coordinates. Can i do this with the
Face_handle???
Many thanks in advance for any help.
Here is some code:
/* ========================================== */
/* Example for Delaunay Triangulation */
/* Example of six 3d-Points that would form 4 faces:
x y z
1 1 0
10 1 0
12 1 0
12 4 0
12 7 0
7 6 0
*/
#include <iostream>
#include <string>
#include <fstream>
#include <list>
#include <stdio.h>
#include <CGAL/basic.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_face_base_2.h>
#include <CGAL/Triangulation_vertex_base_2.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_euclidean_traits_xy_3.h>
struct K : public CGAL::Exact_predicates_inexact_constructions_kernel {};
typedef CGAL::Triangulation_euclidean_traits_xy_3<K> Gt;
typedef CGAL::Delaunay_triangulation_2<Gt> CDT;
typedef K::Point_3 Point;
typedef CDT::Vertex_handle Vertex_handle;
typedef CDT::Face_handle Face_handle;
/* ========================================== */
// Delaunay Triangulation
CDT D_tri;
// list to store points
list<Point> list;
// Now input file points/file be read and points are stored in list ...
// Code for I/O not shown here, but works fine
// Insert points to triangulation
D_tri.insert(list.begin(),list.end());
// Check of Triangulation
cout << "Is triangulation valid? " << D_tri.is_valid() << endl;
int v = D_tri.number_of_vertices();
cout << "NUMBER OF VERTICES: " << v << endl;
int f = D_tri.number_of_faces();
cout << "NUMBER OF FACES: " << f << endl;
/* NOW I NEED TO KNOW THE VERTEX NUMBERS THAT CREATES A FACE
i.e.
1 2 6
6 2 4
3 4 2
4 5 6
with
1 ==> 1 1 0
2 ==> 10 1 0
...
6 ==> 7 6 0
IS THIS DONE WITH THE Face_handle?
HOW DO I ACCESS THE FACES AND THEIR VERTICES?
*/
/* == END===================================== */
- [cgal-discuss] Access vertices of faces in Delaunay Triangulation, matthias.kunz, 02/15/2009
- Re: [cgal-discuss] Access vertices of faces in Delaunay Triangulation, Andreas Fabri, 02/15/2009
- Re: Re: [cgal-discuss] Access vertices of faces in Delaunay, matthias.kunz, 02/15/2009
- Re: [cgal-discuss] Access vertices of faces in Delaunay, Andreas Fabri, 02/15/2009
- Re: Re: [cgal-discuss] Access vertices of faces in Delaunay, matthias.kunz, 02/15/2009
- Re: [cgal-discuss] Access vertices of faces in Delaunay, Andreas Fabri, 02/15/2009
- Re: Re: [cgal-discuss] Access vertices of faces in Delaunay, matthias.kunz, 02/16/2009
- Re: [cgal-discuss] Access vertices of faces in Delaunay, Manuel Caroli, 02/16/2009
- Re: Re: [cgal-discuss] Access vertices of faces in Delaunay, matthias.kunz, 02/16/2009
- Re: [cgal-discuss] Access vertices of faces in Delaunay, Manuel Caroli, 02/16/2009
- Re: [cgal-discuss] Access vertices of faces in Delaunay, Andreas Fabri, 02/16/2009
- Re: Re: [cgal-discuss] Access vertices of faces in Delaunay, matthias.kunz, 02/16/2009
- Re: [cgal-discuss] Access vertices of faces in Delaunay, Andreas Fabri, 02/15/2009
- Re: Re: [cgal-discuss] Access vertices of faces in Delaunay, matthias.kunz, 02/15/2009
- Re: [cgal-discuss] Access vertices of faces in Delaunay, Andreas Fabri, 02/15/2009
- Re: Re: [cgal-discuss] Access vertices of faces in Delaunay, matthias.kunz, 02/15/2009
- Re: [cgal-discuss] Access vertices of faces in Delaunay Triangulation, Andreas Fabri, 02/15/2009
Archive powered by MHonArc 2.6.16.