//
//Same as facevertex.C except that it has different points
//I've written this for testing purposes.
//Also I'm adding information on faces with infinite verteces
//Result: When iterating through faces, doesn't count the faces with infinite
// vertices, so nothing was printed. With infinite faces you can't use any 
// other function/method defined for a normal vertex... :(
//

#include "tutorial.h"
#include <CGAL/Point_2.h>
#include <CGAL/Triangulation_2.h>
#include <iostream>

typedef Triangulation::Vertex_iterator  Vertex_iterator;
typedef Triangulation::Vertex Vertex;
typedef Triangulation::Vertex_handle Vertex_handle;

typedef Triangulation::Face_iterator  Face_iterator;
typedef Triangulation::Face Face;
typedef Triangulation::Face_handle Face_handle;



int main()
{
  Face face;
  Face_handle deref; 
  Vertex_handle v;
  Vertex myvertex;
  
  Point point1(-1, 1);
  Point point2(0,0);
  Point point3(3,4 );
  Point point4(-5,0);

  Triangulation tr;                           // create an empty triangulation
  
  tr.insert(point1);             
  tr.insert(point2);             
  tr.insert(point3); 
  tr.insert(point4);

  std::cout << tr;

  std::cout << "now printing information about faces" <<endl;

  Face_iterator it = tr.faces_begin(); 
  Face_iterator beyond = tr.faces_end(); 
                                       //iterators must be defined after all
                                       //points are declared and added to the
                                       //triangulation

  
  while (it != beyond) {
    face = *it;
    deref = it;
    ++it;
    
    if(tr.is_infinite(deref))  cout << "an infinite face " <<endl; 
      
    cout<<"printing for each face" <<endl; 
    for (int i = 0; i< 3; i++) {
      cout <<"i = "<< i <<endl;
      
      v = face.vertex(i);
      myvertex = *v;                     //dereferencing!!!
      cout << myvertex.point() << endl;
  
    } //end for
    
    
    
  }    //end while
} //end prog








