Subject: CGAL users discussion list
List archive
- From: Michele <>
- To:
- Subject: [cgal-discuss] Triangulation_2 face circulator stange behavior
- Date: Fri, 29 Oct 2010 00:04:32 -0700 (PDT)
Dear all,
I have implemented a code that prints the points and the vertices of the
faces of a triangulation, the code is attacted, with using three different
methods: vertex circulator, face circulator and face iterator.
Both vertex circulator and face iterator show the good result, but it is not
true for the face circulator, why?
Could someone explain me the reasons?
Thank you.
Michele Quinto
This is the output of my code.
print the points belong to triangulation
2 2
2 1
2 0
1 0
0 0
0 1
0 2
1 2
print the faces belong to triangulation (face circulator)
triangle: 6.93721e-310 3.45846e-323 2 2 2 1
triangle: 6.93721e-310 3.45846e-323 2 1 2 0
triangle: 6.93721e-310 3.45846e-323 2 0 1 0
triangle: 0 0 6.93721e-310 3.45846e-323 1 0
triangle: 0 0 0 1 6.93721e-310 3.45846e-323
triangle: 0 1 0 2 6.93721e-310 3.45846e-323
triangle: 6.93721e-310 3.45846e-323 0 2 1 2
triangle: 6.93721e-310 3.45846e-323 1 2 2 2
print the faces belong to triangulation (faces iterator)
triangle: 0 2 0 1 1 0
triangle: 0 1 0 0 1 0
triangle: 1 1 0 2 1 0
triangle: 1 2 0 2 1 1
triangle: 2 0 1 2 1 1
triangle: 1 0 2 0 1 1
triangle: 2 1 1 2 2 0
triangle: 2 2 1 2 2 1
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_2<K> Triangulation;
typedef Triangulation::Vertex_circulator Vertex_circulator;
typedef Triangulation::Face_circulator Face_circulator;
typedef Triangulation::Vertex_iterator Vertex_iterator;
typedef Triangulation::Face_iterator Face_iterator;
typedef Triangulation::Point Point;
int main(int argc, char *argv[])
{
int i, j;
Triangulation t;
for(i=0; i<3; i++)
for(j=0;j<3;j++)
t.insert(Point((double)i,(double)j));
std::cout<<"print the points belong to triangulation"<<std::endl;
Vertex_circulator vc = t.incident_vertices(t.infinite_vertex()),
done(vc);
if(vc!=0)
{
do{
std::cout<< vc->point() <<std::endl;
}while(++vc!=done);
}
std::cout<<"print the faces belong to triangulation (face
circulator)"<<std::endl;
Face_circulator fc = t.incident_faces(t.infinite_vertex()),
done2(fc);
if(fc!=0)
{
do{
std::cout<<"triangle: "
<<fc->vertex(0)->point()<<"\t"
<<fc->vertex(1)->point()<<"\t"<<fc->vertex(2)->point()<<std::endl;
}while(++fc!=done2);
}
std::cout<<"print the faces belong to triangulation (faces
iterator)"<<std::endl;
Face_iterator fi=t.finite_faces_begin();
for(;fi!=t.finite_faces_end();fi++)
{
std::cout<<"triangle: "
<<fi->vertex(0)->point()<<"\t"
<<fi->vertex(1)->point()<<"\t"<<fi->vertex(2)->point()<<std::endl;
}
return 0;
}
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Triangulation-2-face-circulator-stange-behavior-tp3018554p3018554.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Triangulation_2 face circulator stange behavior, Michele, 10/29/2010
- Re: [cgal-discuss] Triangulation_2 face circulator stange behavior, Sebastien Loriot (GeometryFactory), 10/29/2010
- [cgal-discuss] Re: Triangulation_2 face circulator stange behavior, Michele, 10/29/2010
- Re: [cgal-discuss] Re: Triangulation_2 face circulator stange behavior, Sebastien Loriot (GeometryFactory), 10/29/2010
- [cgal-discuss] Re: Triangulation_2 face circulator stange behavior, Michele, 10/29/2010
- Re: [cgal-discuss] Re: Triangulation_2 face circulator stange behavior, Sebastien Loriot (GeometryFactory), 10/29/2010
- [cgal-discuss] Re: Triangulation_2 face circulator stange behavior, Michele, 10/29/2010
- Re: [cgal-discuss] Re: Triangulation_2 face circulator stange behavior, Sebastien Loriot (GeometryFactory), 10/29/2010
- [cgal-discuss] Re: Triangulation_2 face circulator stange behavior, Michele, 10/29/2010
- Re: [cgal-discuss] Re: Triangulation_2 face circulator stange behavior, Sebastien Loriot (GeometryFactory), 10/29/2010
- [cgal-discuss] Re: Triangulation_2 face circulator stange behavior, Michele, 10/29/2010
- Re: [cgal-discuss] Re: Triangulation_2 face circulator stange behavior, Sebastien Loriot (GeometryFactory), 10/29/2010
- [cgal-discuss] Re: Triangulation_2 face circulator stange behavior, Michele, 10/29/2010
- Re: [cgal-discuss] Triangulation_2 face circulator stange behavior, Sebastien Loriot (GeometryFactory), 10/29/2010
Archive powered by MHonArc 2.6.16.