Skip to Content.
Sympa Menu

cgal-discuss - Newbie questions concerning Delaunay_triangulation_3

Subject: CGAL users discussion list

List archive

Newbie questions concerning Delaunay_triangulation_3


Chronological Thread 
  • From:
  • To:
  • Subject: Newbie questions concerning Delaunay_triangulation_3
  • Date: Thu, 14 Jun 2007 14:16:09 -0400 (EDT)

Dear List,

I have recently downloaded and installed CGAL and have run into a minor problem. When I run the attached code, the finite cells include the point (0.5,0.5,0.5), which I have not entered. I only want a delaunay triangulation of the points I have entered. I have tried to remove that point, which corresponds to vertices_begin(), but that results in an exception.

Secondly, is there a structure or method that allows me access to the list of cells of which a given vertex is a member? The documentation of cell() for a vertex has suggested no obvious way to me.

Christopher

PS: Is there a complete class hierarchy diagram for CGAL in the documentation? I haven't come across one so far.

--
C. Rinderspacher, Ph. D.
Duke University
Dept. of Chemistry
Box 97
Durham, NC 27705
Tel.: (919) 660-1633
E-Mail:


The faults of the burglar are the qualities of the financier.
George Bernard Shaw
#include <iostream>
#include <CGAL/basic.h>
#include <CGAL/Delaunay_triangulation_3.h>

#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Point_3.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Delaunay_triangulation_3<Kernel>            Triangulation;
typedef Triangulation::Point                              Point_3;
typedef Triangulation::Cell_iterator                      Cell_iterator;
typedef Triangulation::Vertex_iterator                    Vertex_iterator;
//typedef CGAL::Point_3 Point_3;

using namespace std;

main()
{
  vector<Point_3> L;
  L.push_back(Point_3(0.0,-0.1200944034,0.0));
  L.push_back(Point_3(-1.4301799859,0.9529926662, 0.0000000000 ));
  L.push_back(Point_3( 1.4301799859,0.9529926662, 0.0000000000 ));
  L.push_back(Point_3(-1.4301799859,0.9529926662, 1.0000000000 ));
  L.push_back(Point_3( 1.4301799859,0.9529926662,-1.2000000000 ));
  L.push_back(Point_3( 1.4301799859,0.9529,-1.000000000 ));
  Triangulation td(L.begin(),L.end());
  Cell_iterator Cell;
  /*
    td.insert(Point_3(0.0,-0.1200944034,0.0));
  td.insert(Point_3(-1.4301799859,0.9529926662, 0.0000000000 ));
  td.insert(Point_3( 1.4301799859,0.9529926662, 0.0000000000 ));
  td.insert(Point_3(-1.4301799859,0.9529926662, 1.0000000000 ));
  td.insert(Point_3( 1.4301799859,0.9529926662,-1.2000000000 ));*/
  Vertex_iterator Vertex=td.vertices_begin();
  //  td.remove(td.vertex(1));
  Vertex=td.finite_vertices_begin();
  int k=0;
  while(Vertex != td.vertices_end()) {
    cout << " Vertex : " << k++ << endl;
    cout << "X : " << Vertex->point().x() <<" Y : " << Vertex->point().y() <<" Z : " << Vertex->point().z() << endl;
    Cell=Vertex->cell();
    //    td.index(Cell);
    Vertex++;
  }
  int noc=td.number_of_finite_cells();
  cout << "\n Number of cells    : " << noc;
  cout << "\n Number of facets   : " << td.number_of_finite_facets();
  cout << "\n Number of edges    : " << td.number_of_finite_edges();
  cout << "\n Number of vertices : " << td.number_of_vertices() << endl;
  Cell=td.finite_cells_begin();
  for(int i=0;i<noc;i++, Cell++)
    {
      cout << "Cell " << i << " : \n";
      for(int j=0;j<4;j++)
	cout << "X : " << Cell->vertex(j)->point().x() << " Y : " << Cell->vertex(j)->point().y() << " Z : " << Cell->vertex(j)->point().z() << endl;
    }
}



Archive powered by MHonArc 2.6.16.

Top of Page