Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

[cgal-discuss] Looping through vertices of a face


Chronological Thread 
  • From: Matthew Denno <>
  • To:
  • Subject: [cgal-discuss] Looping through vertices of a face
  • Date: Thu, 11 Jun 2009 22:33:32 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=R6x71/+c7jFJC0LvEjjiTXXHYEpdOhJ4HLvEseCVuzvxyRcu4N2nHQH0YxmxOwJPrn isIqZNIwA4anklFZJGYQAkcljEft0rOSgI97ycYl97Txr1S7XjwtLFrb9VJwaObOpVqE LG+VCrSc5ILTE2Rb2XRH3aiBEqLR1pR6wtfYk=

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