Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] 3D surface mesh generation

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] 3D surface mesh generation


Chronological Thread 
  • From: Laurent Rineau <>
  • To:
  • Subject: Re: [cgal-discuss] 3D surface mesh generation
  • Date: Tue, 24 Jun 2008 17:58:05 +0200

On Tuesday 24 June 2008 16:48:08 Hui Ding wrote:
> Thanx, but what do you mean about "first" "second" of Facet f?? you mean:
> f ->vertex(( (f+1)+1 )&3)f ->vertex(( (f+1)+2 )&3)f ->vertex(( (f+1)+3
> )&3)??

Have you ever read parts of the documentation of CGAL 3D Triangulations?!

If Tr is a 3D triangulation, "Tr::Facet" is the
type "std::pair<Cell_handle,int>".

On Tuesday 24 June 2008 17:15:08 Hui Ding wrote:
> Well, because when I try to do something like this:
>
> std::ofstream oFile("output",std::ios::out);
> for(Facet_iterator fit =
> c2t3.facets_begin();fit!=c2t3.facets_end();fit++){ oFile<<
> fit.first->vertex((fit.second+1)&3)->Point();
> oFile<< fit.first->vertex((fit.second+2)&3)->Point();
> oFile<< fit.first->vertex((fit.second+3)&3)->Point();
> }
>
> it comes the errors:
> error C2227: left of '->Point' must point to class/struct/union/generic
> type error C2039: 'first' : is not a member of 'CGAL::Filter_iterator<I,P>'
> etc.

Here you assume, incorrectly, that Face_iterator is the same type (or at
least
has the same API) as Facet. And you misspelled "point()" as "Point()"!

Use the following:

  for(Facet_iterator fit = c2t3.facets_begin();fit!=c2t3.facets_end();fit++){
     oFile<< fit->first->vertex((fit->second+1)&3)->point();
     oFile<< fit->first->vertex((fit->second+2)&3)->point();
     oFile<< fit->first->vertex((fit->second+3)&3)->point();
  }

You can use a code a bit more clear:

typedef Tr::Cell_handle Cell_handle;

for(Facet_iterator fit = c2t3.facets_begin();fit!=c2t3.facets_end();++fit)
{
const Cell_handle& ch = fit->first;
const int facet_index = fit->second;
oFile<< ch->vertex((facet_index+1)&3)->point();
oFile<< ch->vertex((facet_index+2)&3)->point();
oFile<< ch->vertex((facet_index+3)&3)->point();
}

I hope that will give you the will to read some parts of the documentation.

--
Laurent Rineau, PhD
Engineer at GeometryFactory
http://www.geometryfactory.com/



Archive powered by MHonArc 2.6.16.

Top of Page