Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Vertex index in a Cell (Delauney 3D)

Subject: CGAL users discussion list

List archive

[cgal-discuss] Vertex index in a Cell (Delauney 3D)


Chronological Thread 
  • From: <>
  • To:
  • Subject: [cgal-discuss] Vertex index in a Cell (Delauney 3D)
  • Date: Wed, 7 Oct 2009 23:55:07 +0200 (CEST)

Hi,

Is there a way I can figure which vertex a cell has in Delauney 3D
tiangluation?
So far I only can print the coordinates of a vertex in a cell.

Thanks in advance,

-s

-----------------------------------------------------------------------------------

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
#include <fstream>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;

typedef CGAL::Triangulation_vertex_base_with_info_3<CGAL::Color, K> Vb;
typedef CGAL::Triangulation_data_structure_3<Vb> Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Delaunay;
typedef Delaunay::Cell_handle Cell_iterator;
typedef Delaunay::Vertex_handle Vertex_iterator;

typedef Delaunay::Cell Cell;
typedef Delaunay::Point Point;

int main()
{
Delaunay T;

std::ifstream in("data/voronoi.cin");
std::istream_iterator<Point> begin(in);
std::istream_iterator<Point> end;
T.insert(begin, end);

int i = 0;
Cell_iterator cit =T.cells_begin();
for ( ; cit !=T.cells_end(); ++cit) {
Cell my = *cit;
//Vertex_iterator vit = cit->vertex(0);
std::cout << "Cell[" <<i << "]= (" << *(cit->vertex(0)) << "), (";
std::cout << *(cit->vertex(1)) << "), (";
std::cout << *(cit->vertex(2)) << "), (";
std::cout << *(cit->vertex(3)) << ")\n";

i++;
}

return 0;
}


--------------------------

input(voronoi.cin) is following

0. 0. 0.
0. 0. 1.
0. 1. 1.
1. 0. 0.


-------------------------------

output is the following...

Cell[0]= (0 1 1), (0 0 0), (0 0 0), (0 0 1)
Cell[1]= (1 0 0), (0 1 1), (0 0 0), (0 0 1)
Cell[2]= (0 0 0), (1 0 0), (0 0 0), (0 0 1)
Cell[3]= (0 1 1), (1 0 0), (0 0 0), (0 0 1)
Cell[4]= (1 0 0), (0 0 0), (0 1 1), (0 0 0)



Archive powered by MHonArc 2.6.16.

Top of Page