Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Looping through vertices of a face

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Looping through vertices of a face


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] Looping through vertices of a face
  • Date: Fri, 12 Jun 2009 14:14:03 +0200

Hi Matthew,

The triangulation is parameterized with a triangulation datastructure
which is parameterized with a vertex and face class.


______________________________________________
Parameters
The class Triangulation_2<Traits,Tds> has two template parameters. The first one Traits is the geometric traits, it is to be instantiated by a model of the concept TriangulationTraits_2.

The second parameter is the triangulation data structure, it has to be instantiated by a model of the concept TriangulationDataStructure_2. By default, the triangulation data structure is instantiated by CGAL::Triangulation_data_structure_2 < CGAL::Triangulation_vertex_base_2<Gt>, CGAL::Triangulation_face_base_2<Gt> > >.


Source:
http://www.cgal.org/Manual/3.4/doc_html/cgal_manual/Triangulation_2_ref/Class_Triangulation_2.html#Cross_link_anchor_1166
______________________________________________


Whe you click on CGAL::Triangulation_face_base_2<Gt> you find

______________________________________________

Is Model for the Concepts
TriangulationFaceBase_2

http://www.cgal.org/Manual/3.4/doc_html/cgal_manual/Triangulation_2_ref/Class_Triangulation_face_base_2.html
______________________________________________


"Model of a concept" means implementations of a specification,
so when you click on TriangulationFaceBase_2 and there on
TriangulationDSFaceBase_2

you are one click away from what you search

http://www.cgal.org/Manual/3.4/doc_html/cgal_manual/TDS_2_ref/Concept_TriangulationDSFaceBase_2.html#Cross_link_anchor_1178


The whole thing is rather decomposed, but it makes little sense to repeat the
documentation
of the concept for each model.


andreas




Matthew Denno wrote:
Hi,

I am hoping that someone can point me in the right direction to a
solution for my problem. I am new to both CGAL and C++ so I apologize
if my questions should be obvious.

I started out with one of the example problems. After I have added
the points to the Triangulation, I use a Face_iterator to iterate
through the faces (I think through this part is ok). The problem is I
can't figure out how to access the verticies of each face as I iterate
over them.

If someone could point me in the right direction I would really
appreciate it. Maybe just a hint of what I should look for in the
manual.

The code I have been testing with is below.

Thanks so much.

Matt

#include <fstream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_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::Face_iterator Face_iterator;
typedef Triangulation::Vertex_handle Vertex_handle;
typedef Triangulation::Vertex_iterator Vertex_iterator;

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

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

for (Face_iterator fit = t.faces_begin();
fit != t.faces_end();
++fit){

//This is where the problem is.
//print out the x and y coordinates of all three verticies of each
face

}
return 0;
}




Archive powered by MHonArc 2.6.16.

Top of Page