Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] "Getting list of each interface facet between tetrahedrons"

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] "Getting list of each interface facet between tetrahedrons"


Chronological Thread 
  • From: "Laurent Rineau (CGAL/GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] "Getting list of each interface facet between tetrahedrons"
  • Date: Tue, 15 Oct 2013 16:32:20 +0200
  • Organization: GeometryFactory

Le lundi 14 octobre 2013 23:50:44 Burak ER a écrit :

> Dear Cgal mail list subscribers,

>

> I am searching for a way to get interface facets between all the

> tetrahedras on a mesh. Therefore, every facet should have a self index

> and the tetrahedrons indices which it belongs to. For example;

>

> struct facet{

> int id;

> int tetrahedron_id1;//first tetrahedron

> int tetrahedron_id2;//second tetrahedron

> }

>

> What is the best(fastest) way to solve this problem with cgal 3d

> meshing?

 

You can use the template CGAL::Triangulation_cell_base_with_info_3 to add extra member fields to the cells of CGAL 3D triangulations.

 

For example:

struct Cell_info {

int id;

};

 

Then, on a 3D triangulation, use the facets iterators:

 

std::vector<facet> all_facets; // container of 'facet' struct

int facet_id = 0;

 

for(Tr::Finite_facets_iterator

fit = tr.finite_facets_begin(),

end = tr.finite_facets_end(); fit !=end; ++fit)

{

Tr::Cell_handle cell = fit->first;

int index = fit->second;

 

Tr::Cell_handle other_cell = cell->neighbor(index);

 

// Then here you can use cell->info().id and other_cell->info().id

// to fill your container of facets.

facet new_facet = { facet_id++, cell->info().id, other_cell->info().id };

all_facets.push_back(new_facet);

}

 

In my opinion, you should use 'std::size_t' instead of 'int' as "id type".

 

--

Laurent Rineau, PhD

R&D Engineer at GeometryFactory http://www.geometryfactory.com/

Release Manager of the CGAL Project http://www.cgal.org/

 




Archive powered by MHonArc 2.6.18.

Top of Page