Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Vertex indexing

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Vertex indexing


Chronological Thread 
  • From: Daniel Duque <>
  • To:
  • Subject: Re: [cgal-discuss] Vertex indexing
  • Date: Sun, 22 May 2011 23:50:46 +0200

Hi,

Please make sure you do need an index. Coming from other programming styles, things usually have indices, but in CGAL, as in STL C++, these are often not needed. E.g. if you need to iterate over all vertices, you
have an iterator that begins and ends in the proper places, and you can advance with the ++ operator.

If you are completely sure indices are needed, use the info tutorial (the one about adding a "color" to the vertices), and use the info part to store your index (or whatever you may need).

Best,

Daniel


El 22/05/2011 16:14, Brian Sanjeewa Rupasinghe escribió:
Hi,

This is the code i have used to create Delaunay triangulation and then to print
number of vertices and faces. Now i need to retrieve coordinates of each vertex
using an index. Please let me know how it can be done?  I followed up tutorial in following link.
But could not get how to do it.

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Projection_traits_xy_3.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <fstream>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Projection_traits_xy_3<K>  Gt;
typedef CGAL::Delaunay_triangulation_2<Gt> Delaunay;
typedef K::Point_3   Point;

int _tmain()
{
//std::ifstream in("data/terrain.cin");
std::ifstream in("data/test.cin");
std::istream_iterator<Point> begin(in);
std::istream_iterator<Point> end;
Delaunay dt;
dt.insert(begin, end);
std::cout << dt.number_of_vertices() << std::endl;
std::cout << dt.number_of_faces() << std::endl;
std::cout << dt;

return 0;
}

Best regards,
Brian.




Archive powered by MHonArc 2.6.16.

Top of Page