Skip to Content.
Sympa Menu

cgal-discuss - RegularTriangulation incident_facets - how to use?

Subject: CGAL users discussion list

List archive

RegularTriangulation incident_facets - how to use?


Chronological Thread 
  • From: Thomas Zangl <>
  • To:
  • Subject: RegularTriangulation incident_facets - how to use?
  • Date: Sun, 10 Feb 2008 18:17:46 +0100

Hi!

Given a regular triangulation in 3d called T. I have a facet of it ("f") and now I want to determine if each edge of this facet has at least one non-infinite neighbour. This is my code:

bool FacePreProcessor_3::hasThreeNeighbours(Rt_Facet f) {
cout << "hasThreeNeighbours: begin" << endl;

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
cout << "hasThreeNeighbours: v1=" << vertices[i % 3] << " v2=" << vertices[(i+1) % 3] << endl;
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;

// a neighbour of a cell is every cell, which is not unkown or unused
switch(fCirc->first->info().faces[fCirc->second]) {
case fsUnkown:
case fsUnused:
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;
}

Just to mention: I use cell_base_with_info to mark some faces as "unkown" or "unused" etc. to ignore them in further processing. Ignore this part for understanding.

Now I have the following issue: some incident faces are the same of each edge. See this debug output:

hasThreeNeighbours: begin
hasThreeNeighbours: v1=1 v2=2
hasThreeNeighbours: counting as face: Face 286 / 0 state: AC or Singular (not yet determined)
hasThreeNeighbours: faceCounter=1
hasThreeNeighbours: v1=2 v2=3
hasThreeNeighbours: counting as face: Face 286 / 0 state: AC or Singular (not yet determined)
hasThreeNeighbours: faceCounter=1
hasThreeNeighbours: v1=3 v2=1
hasThreeNeighbours: counting as face: Face 286 / 0 state: AC or Singular (not yet determined)
hasThreeNeighbours: faceCounter=1
hasThreeNeighbours: end. numOfEdgesWithNeighbours = 3

The face named "Face 286 / 0" (286 is the cell index I gave this cell and 0 is the index of the opposite vertex of the cell, JFYI) is strange in this example. Its returned by the function "T.incident_facets" as being incident to each edge of the given Facet "f". This is obviously wrong.

So, I think I use t.incident_facets wrong :-) Please help!

TIA, Thomas



Archive powered by MHonArc 2.6.16.

Top of Page