0

I am performing a 3D Delaunay Triangulation of points sampled from a sphere, and I am looking at the vertices of the resultant triangulation essentially by doing this:

for(Delaunay_Vertex_iter p = T.vertices_begin(); p != T.vertices_end(); p++){

std::cout << p->point() << endl;

}

While T.number_of_vertices() == 270, I get 271 vertices, the first one being the origin (0, 0, 0). Why?

kdottiemo
  • 79
  • 1
  • 8

2 Answers2

3

This is the infinite vertex, which has unspecified coordinates and happens to be the origin here. You should iterate using finite_vertices_begin()/finite_vertices_end() instead. See http://doc.cgal.org/latest/Triangulation_3/ for information about the infinite vertex.

Sylvain Pion
  • 575
  • 1
  • 4
  • 11
0

This can well happen, since floating point numbers are inherently NOT exactly on unit spheres. Hence, the data type or your kernel and the proximity of your sampling affects the results.

You can use CGAL's spherical kernel for the 3D case or the implementation described in: https://stackoverflow.com/a/45240506/4994003 to avoid precision issues for the general dD case.

ree2k
  • 21
  • 4