Subject: CGAL users discussion list
List archive
- From: Panagiotis Foteinos <>
- To:
- Subject: Re: [cgal-discuss] Looping through vertices of a face
- Date: Thu, 11 Jun 2009 21:14:09 -0600
- 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=wAtjlLj9iGR2Hi2R6qt+YblGZDndJ+fGAALVK02fsKmYnKMtsOq2ioUGOF7zm4BqQI 8vTrlBD+YM6jVTxCLHntWsSmOO7qJYxjde+lcaQoFjUs868L7TKRggPEmRK+NdqUrswD F+//nOfJLKvhzLxmGWZhHW0qRjaGsmhODDDYU=
Inside your loop do 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
On Thu, Jun 11, 2009 at 8:33 PM, 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;
}
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
- [cgal-discuss] Looping through vertices of a face, Matthew Denno, 06/12/2009
- Re: [cgal-discuss] Looping through vertices of a face, Panagiotis Foteinos, 06/12/2009
- Re: [cgal-discuss] Looping through vertices of a face, Andreas Fabri, 06/12/2009
- Re: [cgal-discuss] Looping through vertices of a face, Matthew Denno, 06/12/2009
- Re: [cgal-discuss] Looping through vertices of a face, Andreas Fabri, 06/12/2009
- Re: [cgal-discuss] Looping through vertices of a face, Matthew Denno, 06/15/2009
- Re: [cgal-discuss] Looping through vertices of a face, Andreas Fabri, 06/12/2009
- Re: [cgal-discuss] Looping through vertices of a face, Matthew Denno, 06/12/2009
Archive powered by MHonArc 2.6.16.