Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Question on Triangulation

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Question on Triangulation


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] Question on Triangulation
  • Date: Thu, 10 Sep 2009 21:11:20 +0200


Hi Rahul,

Remove the * befor fit.

The manual
http://www.cgal.org/Manual/beta/doc_html/cgal_manual/Triangulation_2_ref/Class_Triangulation_2.html#Cross_link_anchor_1235

says:

Triangle t.triangle ( Face_handle f) Returns the triangle formed
by the three vertices of f.
Precondition: The face is
finite.

and all the face iterators and circulators are convertible to Face_handle.

best regards,

andreas


Rahul Kavalapara wrote:
Hi,

I am trying to output the vertices of triangles in a Triangulation. I tried to iterate over the faces using the faces iterator, output the triangles vertices to std output.

************************************************************************************

#include <fstream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_2.h>
#include <CGAL/Triangle_2.h>

struct K : CGAL::Exact_predicates_inexact_constructions_kernel {};

typedef CGAL::Triangulation_2<K> Triangulation;
typedef Triangulation::Vertex_circulator Vertex_circulator;
typedef Triangulation::Point Point;
typedef Triangulation::Finite_faces_iterator Finite_faces_iterator;

int main()
{
std::ifstream in("triangulation_prog1.cin");
std::istream_iterator<Point> begin(in);
std::istream_iterator<Point> end;

Triangulation t;
t.insert(begin, end);

Finite_faces_iterator fit;
for(fit = t.finite_faces_begin(); fit != t.finite_faces_end(); ++fit)
{
K::Triangle_2 tri_2 = t.triangle(*fit); <<-- Error
std::cout << tri_2 << "\n";
}
return 0;
}


Error:
triangulation_prog1.cpp: In function ‘int main()’:
triangulation_prog1.cpp:39: error: no matching function for call to ‘CGAL::Triangulation_2<K, CGAL::Tds2<CGAL::Tvb<K, CGAL::Tdsvb<void> >, CGAL::Tfb<K, CGAL::Tdsfb<void> > > >::triangle(CGAL::Tfb<K, CGAL::Tdsfb<CGAL::Tds2<CGAL::Tvb<K, CGAL::Tdsvb<void> >, CGAL::Tfb<K, CGAL::Tdsfb<void> > > > >&)’
/usr/include/CGAL/Triangulation_2.h:798: note: candidates are: typename CGAL::Triangulation_2<Gt, Tds>::Triangle CGAL::Triangulation_2<Gt, Tds>::triangle(typename Tds::Face_handle) const [with Gt = K, Tds = CGAL::Tds2<CGAL::Tvb<K, CGAL::Tdsvb<void> >, CGAL::Tfb<K, CGAL::Tdsfb<void> > >]


Am I missing something for the above code.



--
Rahul




Archive powered by MHonArc 2.6.16.

Top of Page