Subject: CGAL users discussion list
List archive
- From: Thomas Zangl <>
- To:
- Subject: Re: [cgal-discuss] Triangulation_3 / Facetiterator
- Date: Tue, 19 Feb 2008 15:09:08 +0100
Manuel Caroli schrieb:
Hi!
the facet iterators as well as the edge iterators return each facet resp. edge exactly ONCE.
I suspected this :)
Thus if for instance you iterate over all facets, you're not guaranteed to get all cells and on the other hand there are cells you will get twice.
Indeed, I except some cells to visit twice using the facet/edge iterator =)
Well, I now have some issues with the iterators. I want to catch all possible (finite) faces of all cells:
unsigned int counter = 0;
for(Rt_Cell_iterator cIt = t.cells_begin(); cIt != t.cells_end(); cIt++) {
for (unsigned int faceIdx = 0; faceIdx < 4; faceIdx++) {
Rt_Facet f(cIt, faceIdx);
if (t.is_infinite(f)) {
cout << "Infinite Facet found." << endl;
continue;
}
// mark the face as not yet visited
cIt->info().faces[faceIdx] = fsUnkown;
cIt->info().visited[faceIdx] = false;
cIt->info().name[faceIdx] = "Face " + DataTypeHelper_3::intToStr(counter) + " / " + DataTypeHelper_3::intToStr(faceIdx);
cout << initializing face: " << cIt->info().name[faceIdx] << " state: " << cIt->info().toString(faceIdx) << endl;
}
counter++;
}
AFAIK this should work. I visite all cells and mark their finite faces with some info.
Now I iterate over them:
for(Rt_Finite_facet_iterator fIt = t.finite_facets_begin(); fIt != t.finite_facets_end(); fIt++) {
Rt_Cell_handle cell = fIt->first;
// this is the index of the facet's opposite vertex
int faceIndex = fIt->second;
// do some work ..
// mark them all as singular
cell->info().faces[faceIndex] = fsSingular;
cell->neighbor(faceIndex)->info().faces[faceIndex] = fsSingular;
}
As you can see, I iterate over all finite faces and mark them as "singular". I even mark the same face but viewed from the neighbor cell. Is that true?
If I then iterate over them again like this:
for(Rt_Cell_iterator cell = t_->cells_begin(); cell != t_->cells_end(); cell++) {
for (unsigned int faceIdx = 0; faceIdx < 4; faceIdx++) {
if (t_->is_infinite(cell, faceIdx)) {
continue;
}
// do some work
assert(cell->info().faces[faceIdx] != fsUnkown);
}
counter++;
}
the assertion is thrown.
So there is some difference between iterating over all cells and visit each facet of the cell and iterating over all facets and mark the facet and its opposite?
Any hints please! TIA!
Thomas
- Triangulation_3 / Facetiterator, Thomas Zangl, 02/19/2008
- Re: [cgal-discuss] Triangulation_3 / Facetiterator, Manuel Caroli, 02/19/2008
- Re: [cgal-discuss] Triangulation_3 / Facetiterator, Thomas Zangl, 02/19/2008
- Re: [cgal-discuss] Triangulation_3 / Facetiterator, Manuel Caroli, 02/19/2008
- Re: [cgal-discuss] Triangulation_3 / Facetiterator, Thomas Zangl, 02/19/2008
- Re: [cgal-discuss] Triangulation_3 / Facetiterator, Manuel Caroli, 02/19/2008
Archive powered by MHonArc 2.6.16.