Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Indexes of facets in a 3D Delaunay Triangulation

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Indexes of facets in a 3D Delaunay Triangulation


Chronological Thread 
  • From: Renata Lucia Mendonca Ernesto do Rego <>
  • To:
  • Subject: Re: [cgal-discuss] Indexes of facets in a 3D Delaunay Triangulation
  • Date: Mon, 6 May 2013 14:18:21 -0300

Thank you very much!


2013/5/6 Mariette Yvinec <>

Hi

Since a facet is described by a pair (cell, index)
there are two possible descriptions for each facet.
The finite_facet_iterator  manage to output each facet only once
and as a result you input un your map only one description (cell,index)
for each facet. Then of course if latter you happen to search
the other description you won't find it.

Possible remedies:
- search the map with both descriptions  f and tds.mirror_facet(f)
- input both in the map
- use a unique description of each facet to build and search the map


Le 06/05/13 18:03, Renata Lucia Mendonca Ernesto do Rego a écrit :
Dear all,

I'm new to CGAL, and I apologize if you have already answered some question similar to mine before.
But I searched and I could not find an answer yet.

I need to describe the cells of the Delaunay triangulation as a list of indexes to its facets.

I tried to do this by storing the facets in a std::map
std::map<Delaunay::Facet, int>  vmap_facets;

I iterate through the finite facets of the Delaunay triangulation and insert each facet into the map:
Delaunay::Finite_facets_iterator it;
int i = 0;
for (it = T.finite_facets_begin(); it != T.finite_facets_end(); it++)
{
   vmap_facets.insert( std::pair<Delaunay::Facet,int>(*it,nf) );
   i++;
}


Then I iterate through the finte cells and I access each of its facets.
However, when I search the map for these facets, some of them cannot be found, i.e, function find() returns end().
Seems that these facets were not visited in the previous loop with the Finite_facets_iterator.


for (it_c = T.finite_cells_begin(); it_c != T.finite_cells_end(); it_c++)
{
   Delaunay::Facet f0 = Delaunay::Facet(it_c,0);
   Delaunay::Facet f1 = Delaunay::Facet(it_c,1);
   Delaunay::Facet f2 = Delaunay::Facet(it_c,2);
   Delaunay::Facet f3 = Delaunay::Facet(it_c,3);

   std::map<Delaunay::Facet,int>::iterator it_f0 = vmap_facets.find(f0);
   std::map<Delaunay::Facet,int>::iterator it_f1 = vmap_facets.find(f1);
   std::map<Delaunay::Facet,int>::iterator it_f2 = vmap_facets.find(f2);
   std::map<Delaunay::Facet,int>::iterator it_f3 = vmap_facets.find(f3);
   //some of these iterators are equals to vmap_facets.end()

   int f_idx0 = it_f0->second;
   int f_idx1 = it_f1->second;
   int f_idx2 = it_f2->second;
   int f_idx3 = it_f3->second;
   //Indexes of the facets
}

Does someone know why the facets cannot be found in the map?
Or is there another way to get facets indexes of the cells?

Thank you in advance!

Renata

-- 
Mariette Yvinec
Geometrica project team
INRIA  Sophia-Antipolis  






Archive powered by MHonArc 2.6.18.

Top of Page