Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Re: Extracting Information to Simple Array Format, Triangulation connectivity

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Re: Extracting Information to Simple Array Format, Triangulation connectivity


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Re: Extracting Information to Simple Array Format, Triangulation connectivity
  • Date: Fri, 06 Aug 2010 08:10:52 +0200

I bet this is the infinite vertex.
Try using function is_infinite(Vertex_handle) and maybe have a look at
the documentation to understand what it means:


Look at the first 10 lines here:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_3/Chapter_main.html#Section_37.1


S.

htg20 wrote:
Dear Sebastien,

Regarding the triangulation_with_info that we were discussing about, I
actually did not test it properly. Today I was able to put this in my code,
and I figured out actually there is something wrong. When I run the code
below, well it runs; However I get one extra vertex which is not given any
info. Just see the code with the output.


#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
struct K : CGAL::Exact_predicates_inexact_constructions_kernel {};
typedef CGAL::Triangulation_vertex_base_with_info_3<unsigned long, K> Vb;
typedef CGAL::Triangulation_data_structure_3<Vb> Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Delaunay;
typedef Delaunay::Point Point;
typedef Delaunay::Cell_iterator Cell_iterator;
typedef Delaunay::Vertex_handle Vertex_handle;
int main()
{
Delaunay T;
Vertex_handle vh, vh1,vh2,vh3,vh0;

vh = T.insert(Point(-1,0,0));
vh->info() = 1; //attaching an index for each point from 1 to 8.
vh = T.insert(Point(1,0,0));
vh->info() = 2;
vh = T.insert(Point(-1,0,1));
vh->info() = 3;
vh = T.insert(Point(1,0,1));
vh->info() = 4;
vh = T.insert(Point(-1,1,0));
vh->info() = 5;
vh = T.insert(Point(1,1,0));
vh->info() = 6;
vh = T.insert(Point(-1,1,1));
vh->info() = 7;
vh = T.insert(Point(1,1,1));
vh->info() = 8;

std::cout << "Number of cells=" << T.number_of_cells() << "\n";
std::cout << "Number of vertices=" << T.number_of_vertices() << "\n";

for ( Cell_iterator cellIt=T.cells_begin(); cellIt!=T.cells_end();
cellIt++)
{
vh0= cellIt-> vertex(0);
vh1= cellIt-> vertex(1);
vh2= cellIt-> vertex(2);
vh3= cellIt-> vertex(3);
std:: cout << vh0->point()<<std::endl;
std:: cout << vh1->point()<<std::endl;
std:: cout << vh2->point()<<std::endl;
std:: cout << vh3->point()<<std::endl;
std::cout<< " cell vertices= " << vh0
->info() << " " << vh1 ->info()<< " " << vh2 ->info() << " " << vh3
->info() << std::endl;

}

return 0;
}




This gives me:

Number of cells=18
Number of vertices=8
-1 0 0
0 0 0
-1 0 1
-1 1 0
cell vertices= 1 0 3 5
1 0 0
-1 0 0
-1 0 1
-1 1 0
cell vertices= 2 1 3 5
-1 0 1
-1 0 0
1 0 0
0 0 0
cell vertices= 3 1 2 0
-1 0 0
1 0 0
0 0 0
-1 1 0
cell vertices= 1 2 0 5
0 0 0
1 0 1
-1 0 1
-1 1 1
cell vertices= 0 4 3 7
1 1 0
1 1 1
0 0 0
-1 1 1
cell vertices= 6 8 0 7
1 1 0
1 0 1
0 0 0
1 1 1
cell vertices= 6 4 0 8
1 0 0
1 0 1
-1 0 1
0 0 0
cell vertices= 2 4 3 0
1 0 0
1 0 1
0 0 0
1 1 0
cell vertices= 2 4 0 6
1 1 0
1 0 1
1 1 1
-1 1 1
cell vertices= 6 4 8 7
1 0 0
1 1 0
0 0 0
-1 1 0
cell vertices= 2 6 0 5
1 1 1
1 0 1
0 0 0
-1 1 1
cell vertices= 8 4 0 7
-1 0 1
1 0 1
1 0 0
-1 1 1
cell vertices= 3 4 2 7
1 0 0
1 0 1
1 1 0
-1 1 1
cell vertices= 2 4 6 7
1 1 0
-1 1 1
0 0 0
-1 1 0
cell vertices= 6 7 0 5
0 0 0
-1 1 1
-1 0 1
-1 1 0
cell vertices= 0 7 3 5
-1 0 1
-1 1 1
1 0 0
-1 1 0
cell vertices= 3 7 2 5
1 0 0
-1 1 1
1 1 0
-1 1 0
cell vertices= 2 7 6 5



As you see, the vertex with info()==0 is not defined and it refers to the
point (0,0,0).

Cheers
Hossein





Archive powered by MHonArc 2.6.16.

Top of Page