

#include <iostream.h>
#include <math.h>
#include "total.h"

main()
{
  //first, initialize your own monotone polygon
  
  cout<<"**********************************************"<<endl;
  cout<<"Welcome to triangulation of monotone polygon!"<<endl;
  cout<<"**********************************************"<<endl<<endl;
  cout<<"                   STOP!                     "<<endl;
  cout<<"    ONE IMPORTANT THING BEFORE YOU START...   "<<endl<<endl;
  cout<<"   Please notice that this program is only for"<<endl;
  cout<<"monotone polygon! I will probably expand  the "<<endl;
  cout<<"program later for the case  of  an  arbitrary "<<endl;
  cout<<"polygon. I'd  like  to  mention   AGAIN   the  "<<endl;
  cout<<"definition of a monotone polygon.  A  polygon"<<endl;
  cout<<"is monotone if its boundary is composed of two"<<endl;
  cout<<"monotone chains: the polygon's  upper  chain"<<endl;
  cout<<"and lower chain.  A vertex chain is said to be "<<endl;
  cout<<"monotone if every vertical  line  crosses  it"<<endl;
  cout<<"in at most one point. When  a  montone  chain"<<endl;
  cout<<"is  traversed  beginning  from  its  leftmost "<<endl;
  cout<<"vertex,its vertices are visited by increasing"<<endl;
  cout<<"x-coordinates. Both upper and  lower  chains"<<endl;
  cout<<"terminate at the polygon's  leftmost  vertex "<<endl;
  cout<<"and rightmost vertex."<<endl;
  cout<<"   so I strongly suggest  you  draw  a  graph"<<endl; 
  cout<<"before  enterring  your  vertices. You  will "<<endl;
  cout<<"directly get the triangles you want. Go ahead"<<endl;
  cout<<"and enjoy it!"<<endl<<endl<<endl;
  


  cout<<"Now please input the # of vertices:"<<endl;
  int n;
  cin>>n;
  cout<<"the # of vertices of your polugon is:"<<n<<endl<<endl;
  
  cout<<"Now please input x,y-coordinates of your vertices one by one:"<<endl;
  double x,y;
  Polygon p;
  for(int i=0;i<n;i++)
    {
      cin>>x;
      cin>>y;
      Point pnt(x,y);
      p.insert(pnt);
    } 
  
  
  cout<<"Your vertices are:"<<endl;
  p.advance(CLOCKWISE);
  for(int i=0;i<n;i++)
    {
      Point pp = p.point();
      cout<<"("<<pp.x<<","<<pp.y<<")"<<endl;
      p.advance(CLOCKWISE);
    }  



  Triangulation_1  method1;   //method1 is an object of class Triangultion_1

  extfunc_of_triangulation(method1,p);
       
  return 0;
}
