Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Re: CGAL 3d Mesh Triangulation. Facets with too many neighbors facets.

Subject: CGAL users discussion list

List archive

[cgal-discuss] Re: CGAL 3d Mesh Triangulation. Facets with too many neighbors facets.


Chronological Thread 
  • From: Ianic <>
  • To:
  • Subject: [cgal-discuss] Re: CGAL 3d Mesh Triangulation. Facets with too many neighbors facets.
  • Date: Fri, 3 Sep 2010 05:16:29 -0700 (PDT)


Cells are oriented positively, see

http://www.cgal.org/Manual/3.7-beta1/doc_html/cgal_manual/Triangulation_3/Chapter_main.html#Section_37.1

Facet is represented implicitly as a pair of 1) cell it belongs to and 2) an
opposite vertex number. So you can look at a facet from two adjacent cells
and therefore there is no orientation per se unless you enforce it somehow.
The way I did it is this. First, I make sure that I look at a facet from
within the domain of interest. Then I check the opposite vertex number i. If
it is even (i = 0 or 2), then the positive facet (i.e. with vertices
enumerated counterclockwise) will consist of cell vertices with numbers

(i + 1) % 4, (i + 2) % 4, (i + 3) % 4.

Otherwise it should be

(i + 1) % 4, (i + 3) % 4, (i + 2) % 4.

If you output facets this way, you will have a consistent surface
orientation. Here is the portion of File_medit.h file that I edited to
output it this way:

//-------------------------------------------------------
// Facets
//-------------------------------------------------------
int number_of_triangles = c3t3.number_of_facets();
if ( print_each_facet_twice )
number_of_triangles += number_of_triangles;

os << "Triangles" << std::endl
<< number_of_triangles << std::endl;

for( Facet_iterator fit = c3t3.facets_begin();
fit != c3t3.facets_end();
++fit)
{
const Facet f = ( c3t3.is_in_complex(fit->first) ) ? *fit :
c3t3.triangulation().mirror_facet(*fit);
// facet vertices in CCW order
const Vertex_handle& vh1 = f.first->vertex( (f.second + 1)%4 );

const Vertex_handle& vh2 = (f.second % 2 != 1) ?
f.first->vertex( (f.second + 2)%4 ) :
f.first->vertex( (f.second + 3)%4 );

const Vertex_handle& vh3 = (f.second % 2 != 1) ?
f.first->vertex( (f.second + 3)%4 ) :
f.first->vertex( (f.second + 2)%4 );

os << V[vh1] << " " << V[vh2] << " " << V[vh3] << " ";
os << get(facet_pmap, f) << std::endl;

// Print triangle again if needed
if ( print_each_facet_twice )
{
os << V[vh1] << " " << V[vh2] << " " << V[vh3] << " ";
os << get(facet_twice_pmap, f) << std::endl;
}
}

Hope this helps.


mparusinski wrote:
>
> Actually how are the tetrahedra orientated and how are the facets
> orientated in CGAL?
>

--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/CGAL-3d-Mesh-Triangulation-Facets-with-too-many-neighbors-facets-tp2332420p2525556.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.16.

Top of Page