Subject: CGAL users discussion list
List archive
- From: Andreas Fabri <>
- To:
- Subject: Re: [cgal-discuss] Getting a Triangle from Facet_iterator
- Date: Sat, 26 Jan 2013 06:45:15 +0100
- Organization: GeometryFactory
Hello,
On the reference manual page of Triangulation_3
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_3_ref/Class_Triangulation_3.html#Cross_link_anchor_1363
you can find the method
Triangle t.triangle ( Facet f)
Taken that you have a Facet_iterator, it shouldn't be a surprise
that when you dereference the iterator you get a Facet.
So you have to write
t.triangle(*it)
andreas
On 25/01/2013 22:44, Sidnei Basei wrote:
Hello,
I'm new in CGAL library and I didn't found any example showing how I can get
triangles from facet iterator.
Please, check my code bellow... and help me please....
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_3.h>
#include <iostream>
#include <fstream>
#include <cassert>
#include <vector>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_3<K> Triangulation;
typedef Triangulation::Cell_handle Cell_handle;
typedef Triangulation::Vertex_handle Vertex_handle;
typedef Triangulation::Locate_type Locate_type;
typedef Triangulation::Point Point;
int main()
{
// construction from a list of points :
std::vector<Point> P;
std::ifstream is("/Users/srb/Downloads/tora_teste3.csv");
int n;
is >> n;
std::cout << "Reading " << n << " points " << std::endl;
for( ; n>0 ; n--) {
Point p;
is >> p;
P.push_back(p);
}
std::cout << "Readed: " << P.size() << std::endl;
std::cout << "iniciando. ... " << std::endl;
Triangulation T(P.begin(), P.end());
Triangulation::Facet_iterator it;
unsigned int cc=0;
for(it=T.facets_begin();it!=T.facets_end();it++) {
/// --- I'll integrate with OpenGL here...
// T.triangle() <---- i want get a triangle here!!!
}
std::cout << T.number_of_facets() << " cc: " << cc << std::endl; //
number_of_facets and cc are equals
return 0;
}
Thanks in advance.
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Getting-a-Triangle-from-Facet-iterator-tp4656587.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
--
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project
phone: +33.492.954.912 skype: andreas.fabri
- [cgal-discuss] Getting a Triangle from Facet_iterator, Sidnei Basei, 01/25/2013
- Re: [cgal-discuss] Getting a Triangle from Facet_iterator, Andreas Fabri, 01/26/2013
- Re: [cgal-discuss] Getting a Triangle from Facet_iterator, Sidnei Basei, 01/26/2013
- Re: [cgal-discuss] Getting a Triangle from Facet_iterator, Andreas Fabri, 01/26/2013
Archive powered by MHonArc 2.6.18.