Subject: CGAL users discussion list
List archive
- From: Matthew Denno <>
- To:
- Subject: Re: [cgal-discuss] Question on Triangulation
- Date: Thu, 10 Sep 2009 14:51:46 -0400
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=b1BQTQT8Bp9g5G47JBTAWoqT2Wnj1O1n1Gyk9D7NesAX8HjtY3lOWD1nQ+UpPUwdJl Z5YUlz/fv4Ezjz+nXvMfbufqO4sUgCO6sar6tP8Yz/tJjq6jHf2+ZNylp7VMj31m0WvU r5PVOBJQUQaWLQ79TZbyzlFnNB2jUEuSSexYk=
I am sort of new to this myself so take this for what it is worth, but...
Inside your loop do try something like this:
std::cout << fit->vertex(0)->point(); // the first vertex
std::cout << fit->vertex(1)->point(); //the second
std::cout << fit->vertex(2)->point(); //the third
or if you want a triangle try something like:
Point t1p1 = fit1->vertex(0)->point();
Point t1p2 = fit1->vertex(1)->point();
Point t1p3 = fit1->vertex(2)->point();
Triangle t1 = Triangle(t1p1,t1p2,t1p3);
If you want to do this second option you will have to typedef Point and Triangle.
On Thu, Sep 10, 2009 at 2:26 PM, 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
- [cgal-discuss] Question on Triangulation, Rahul Kavalapara, 09/02/2009
- Re: [cgal-discuss] Question on Triangulation, Camille Wormser, 09/02/2009
- Re: [cgal-discuss] Question on Triangulation, Rahul Kavalapara, 09/02/2009
- <Possible follow-up(s)>
- [cgal-discuss] Question on Triangulation, Rahul Kavalapara, 09/10/2009
- Re: [cgal-discuss] Question on Triangulation, Matthew Denno, 09/10/2009
- Re: [cgal-discuss] Question on Triangulation, Andreas Fabri, 09/10/2009
- Re: [cgal-discuss] Question on Triangulation, Rahul Kavalapara, 09/10/2009
- Re: [cgal-discuss] Question on Triangulation, Andreas Fabri, 09/10/2009
- Re: [cgal-discuss] Question on Triangulation, Rahul Kavalapara, 09/10/2009
- Re: [cgal-discuss] Question on Triangulation, Camille Wormser, 09/02/2009
Archive powered by MHonArc 2.6.16.