Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] RegularTriangulation incident_facets - how to use?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] RegularTriangulation incident_facets - how to use?


Chronological Thread 
  • From: Manuel Caroli <>
  • To:
  • Subject: Re: [cgal-discuss] RegularTriangulation incident_facets - how to use?
  • Date: Thu, 14 Feb 2008 10:15:29 +0100

Hi Thomas,

do you store the facet tags in both incident cells?
facet.first gives you one of the two incident cells, but you don't know a priori which one. So either you have to store the information twice or you don't only check facet.first but also facet.first->neighbor(facet.second) for tags.

Hope this helps

Manuel


Thomas Zangl wrote:
Manuel Caroli schrieb:

Hi!

So, I re-ask, if the following code is correct:
After a first glance it looks ok to me. What exactly makes you think that the output is not correct?

It finds too few incident triangles. I tried something different:

Facet f consists of a three vertices. I can get them like this:

Rt_vertex_handle a = f.first->vertex((f.second + 1) % 4);
Rt_vertex_handle b = f.first->vertex((f.second + 2) % 4);
Rt_vertex_handle c = f.first->vertex((f.second + 3) % 4);

and now I iterate over the triangulation:

unsigned int matchedFacets = 0;
Rt_facet_iterator fIt = t_->facets_begin();
Rt_facet_iterator fEnd = t_->facets_end();

while (fIt != fEnd) {
if (t_->is_infinite(*fIt)) {
++fIt;
continue;
}

if (fI->first == f.first && f.second == fIt->second){
++fIt; continue;
}

switch(fIt->first->info().faces[fIt->second]) {
case fsUnkown:
case fsUnused:
case fsSingular:
++fIt;
continue;
break;
default: ; // do nothing
}

bool ma = false;
bool mb = false;
bool mc = false;

Rt_vertex_handle fa = fIt->first->vertex((fIt->second + 1) % 4);
Rt_vertex_handle fb = fIt->first->vertex((fIt->second + 2) % 4);
Rt_vertex_handle fc = fIt->first->vertex((fIt->second + 3) % 4);

// check which vertices are the same?
if ((a == fa) || (a == fb) || (a == fc)) {
ma=true;
}
if ((b == fa) || (b == fb) || (b == fc)) {
mb=true;
}
if ((c == fa) || (c == fb) || (c == fc)) {
mc=true;
}

// assert if all 3 vertices match - BUG!
assert(!(ma && mb && mc));
// now check the flags... at least two TRUE flags are one side

if (ma && mb) {
// side A matched
matchedFacets++;
}
if (mb && mc) {
// side B matched
matchedFacets++;
}
if (mc && ma) {
// side C matched
matchedFacets++;
}
++fIt;
}

Please note, I am at work now and I wrote the code w/o compiling it.
But I hope it makes the concept clear :-) So, whats the difference? I check if each facet shares 2 vertices with my Facet f. If that is true, they share the same edge. I think thats the same if I say, the facet is incident to f. Right?

I ran the code I posted earlier (with t.incident_facets(..)) and I ran my code above. The number of incident facets is different. The method using t.incident_facets always returnd fewer incident facets than my method.

Any ideas? TIA!



Archive powered by MHonArc 2.6.16.

Top of Page