#include <cassert>
#include <iostream>
using namespace std;

#include <commandline.h>
#include <quickhull2Dtest.h>
#include <quickhull3Dtest.h>
#include <typedefs.h>
#include <zero.h>

template<>
double zero<double>::val = 1E-10;


int main(int argc, char** argv)
{
  commandline cmd(argc,argv);
  uint prog(0);
  cmd.mapvar(prog,"prog");

  switch (prog)
  {
    case 0:

      cout << "Generate 2D points and find and display the convex hull." << endl;
      cout << "  ./main prog=2 pointsfile=data.txt numPoints=300" << endl;
      cout << "Generates random 2D points in unit circle and writes them to a file." << endl;
      cout << "  ./main prog=4 pointsfile=data.txt numPoints=30" << endl;

      cout << "Calculate the Convex hull of a set of 2D points." << endl;
      cout << "  Read file of points, writes the hull indexes." << endl;
      cout << "  Optional randomize to guarantee O(nlogn) time complexity." << endl;

      cout << "  ./main prog=5 pointsfile=data.txt hullfile=hull.txt randomize" << endl;

      cout << "Display the convex hull and points by reading in the points and hull indexes." << endl;
      cout << "  ./main prog=6 pointsfile=data.txt hullfile=hull.txt" << endl;
      cout << "Quickhull 3D Algorithm (Experiment)" << endl;
      cout << "  ./main prog=11 n=40" << endl;

      break;

    case 2: quickhull2Dtest().test02(argc,argv); break;
    case 3: quickhull2Dtest::test03(); break;
    case 4: quickhull2Dtest::test04(argc,argv); break;
    case 5: quickhull2Dtest::test05(argc,argv); break;
    case 6: quickhull2Dtest().test06(argc,argv); break;

    case 11: quickhull3Dtest().test01(argc,argv); break;
    //case 12: quickhull3Dtest().test02(argc,argv); break;

    default: cout << "error:  No case handled." << endl; return 1;
  }

  return 0;
}



