#ifndef CGAL_USE_QT
#include <iostream>
int main(int, char*){
  std::cout << "Sorry, this demo needs QT..." << std::endl; return 0;}
#else
#include <iostream>
#include <vector>
#include <CGAL/Cartesian.h>
#include <CGAL/Filtered_kernel.h>
#include <CGAL/Point_3.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_hierarchy_3.h>
#include <CGAL/Random.h>
#include <qapplication.h>
#include <CGAL/Timer.h>


//typedef float                               Number_type;
//typedef double                              Number_type;
typedef CGAL::Quotient<CGAL::MP_Float>      Number_type;
typedef CGAL::Cartesian<Number_type>        KK;

typedef KK                                  K;
//typedef CGAL::Filtered_kernel<KK >          K;








typedef CGAL::Point_3<K> 		    Point;
typedef CGAL::Triangulation_vertex_base_3<K>             Vbb;
typedef CGAL::Triangulation_hierarchy_vertex_base_3<Vbb> Vb;
typedef CGAL::Triangulation_cell_base_3<K>               Cb;
typedef CGAL::Triangulation_data_structure_3<Vb,Cb>      Tds;
typedef CGAL::Delaunay_triangulation_3<K,Tds>            Dt;
typedef CGAL::Triangulation_hierarchy_3<Dt>              Delaunay;



int main( int argc, char **argv )
{
    int Nb_points;
    CGAL::Timer cost;cost.reset();cost.start();

    long seed;

    std::cout<<" Nombre de points ? "<<std::endl;
    std::cin>>Nb_points;
    std::cout<<" Initiation random ? "<<std::endl;
    std::cin>>seed;
    CGAL::Random random(seed);
    std::cout<<random.get_double()<<std::endl;

    Delaunay dt1;  

    Number_type plan_a = random.get_double()/3;
    Number_type plan_b = random.get_double()/3;
    Number_type plan_c = random.get_double()/3;
    dt1.insert( Point( 0, 0, 0) );
    dt1.insert( Point( 0, 0, 2) );
    dt1.insert( Point( 0, 2, 0) );
    dt1.insert( Point( 0, 2, 2) );
    dt1.insert( Point( 2, 0, 0) );
    dt1.insert( Point( 2, 0, 2) );
    dt1.insert( Point( 2, 2, 0) );
    dt1.insert( Point( 2, 2, 2) );


    for( int i = 0 ; i<Nb_points;++i) {

      Number_type x = random.get_double();
      Number_type y = random.get_double();
      Number_type z = plan_a*x+plan_b*y+plan_c;

      dt1.insert( Point( x, y, z ) );
      std::cout<<"\b\b\b\b\b\b\b\b\b"<<i<<" ";
    }
    std::cout<<std::endl<<Nb_points<<" points triangules en "
             <<cost.time()<<" secondes"<<std::endl;


}
#endif
