Skip to Content.
Sympa Menu

cgal-discuss - Facet_Circulator: too few facets counted..

Subject: CGAL users discussion list

List archive

Facet_Circulator: too few facets counted..


Chronological Thread 
  • From: Thomas Zangl <>
  • To:
  • Subject: Facet_Circulator: too few facets counted..
  • Date: Fri, 29 Feb 2008 12:22:47 +0100

Hi!

I suspect that I do not use the Facet_Circulator properly.

I want to know for each edge of a RegularTriang. Facet if there is at least one neighbour facet. I do it like this:

unsigned int numOfEdgesWithNeighbours = 0;
unsigned int faceCounter = 0;
unsigned int vertices[3];

vertices[0] = (f.second+1) % 4;
vertices[1] = (f.second+2) % 4;
vertices[2] = (f.second+3) % 4;

for (unsigned int i = 0; i < 3; i++) {
// faceIndex + 1 = next vertex
// faceIndex + 2 = next next vertex, forming the edge
Rt_Facet_circulator fCirc = t_->incident_facets(f.first, vertices[i % 3], vertices[(i+1) % 3]);
Rt_Facet_circulator fCircEnd = fCirc;
faceCounter = 0;
do {
if (t_->is_infinite(*fCirc))
continue;
if ((fCirc->first == f.first) && (fCirc->second == f.second)) {
continue;
}
// a neighbour of a cell is every cell, which is not unkown or unused or non-singular
FacetState fState = fCirc->first->info().faces[fCirc->second];
if ((fState == fsUnkown) or (fState == fsUnused)) {
fState = fCirc->first->neighbor(fCirc->second)->info().faces[fCirc->first->neighbor(fCirc->second)->index(fCirc->first)];
}
switch(fState) {
case fsUnkown:
case fsUnused:
case fsSingular:
continue;
break;
default:
cout << "hasThreeNeighbours: counting as face: " << fCirc->first->info().name[fCirc->second] << " state: " << fCirc->first->info().toString(fCirc->second) << endl;
faceCounter++;
}
} while(++fCirc!=fCircEnd);

if (faceCounter > 0) {
cout << "hasThreeNeighbours: faceCounter=" << faceCounter << endl;
numOfEdgesWithNeighbours++;
}
}
cout << "hasThreeNeighbours: end. numOfEdgesWithNeighbours = "<< numOfEdgesWithNeighbours << endl;

return (numOfEdgesWithNeighbours == 3) ? true : false;

So, I now have the problem that some faces are counted twice. E.g. if I have the edge (2,3) I get the same face as with the edge (0,2). So there must be a bug :-)

I also tried some different algo which does a simple vertex_handle compare (e.g. iterate over all Rt_Facets of the Reg.Triang unsing the finite_facet_iterator, get the 3 edges and compare the vertex handles). This works as expected. But its inefficient. So I want to use the incident_facets stuff...

Any ideas? TIA!

Thomas



Archive powered by MHonArc 2.6.16.

Top of Page