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:47:22 +0200


Hi Rahul,

its' explained here:


33.4 Basic Triangulations

33.4.1 Description

The class Triangulation_2<Traits,Tds> serves as a base class for the other 2D
triangulations classes and implements the user interface to a triangulation.

The vertices and faces of the triangulations are accessed through handles, iterators and circulators. A handle is a model of the concept Handle which basically offers the two dereference operators * and -> . A circulator is a type devoted to visit circular sequences. Handles are used whenever the accessed element is not part of a sequence. Iterators and circulators are used to visit all or parts of the triangulation.

The iterators and circulators are all bidirectional and non mutable. The circulators and iterators are convertible to the handles with the same value type, so that when calling a member function, any handle type argument can be replaced by an iterator or a circulator with the same value type.

Source:
http://www.cgal.org/Manual/beta/doc_html/cgal_manual/Triangulation_2/Chapter_main.html




The word "Handle" in the quote above leads here:
http://www.cgal.org/Manual/beta/doc_html/cgal_manual/Circulator_ref/Concept_Handle.html#Cross_link_anchor_1894

andreas



Rahul Kavalapara wrote:
@Mathew Denno,
Thanks, It worked.

@ Andreas
Thanks. It worked.

"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."

From the above statement, did you mean face iterators and circulators are implicitly converted to Face_Handle ?
If I had to that explicitly, do I just type cast it ?
I need to check the documentation and source code to deeply understand them.




--
Rahul


On Thu, Sep 10, 2009 at 1:11 PM, Andreas Fabri < <mailto:>> wrote:


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


-- You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss






Archive powered by MHonArc 2.6.16.

Top of Page