

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

#include <point.h>

#include <d3func.h>
#include <d3sphere.h>

#include <rand.h>



typedef point3<double> pt3;

typedef unsigned int uint;
typedef unsigned int const uintc;



d3func * p3dfunc = new d3sphere(pt3(),0.6);


void d3writefile(string const name, uintc n)
{
  ofstream f1(name.c_str());

  random11<double> r;

  f1 << n << endl;
  for (uint i=0; i<n; ++i)
  {
    pt3 x(-1.0+2.0*r(),-1.0+2.0*r(),-1.0+2.0*r());
    f1 << x << " " << p3dfunc->eval(x) << endl;
  }

} 

void test01()
{
  cout << "Utiltiy program:  Generating files of data points." << endl;
  cout << "Enter the number of points n: ";
  uint n;
  cin >> n;
  cout << "Enter the file name: ";
  string name;
  cin >> name;

  d3writefile(name,n);
}

void test02()
{
  cout << "Generating Test files increasing in powers of two." << endl;

  d3writefile("data0",50);
  d3writefile("data1",100);
  d3writefile("data2",200);
  d3writefile("data3",400);
  d3writefile("data4",800);
  d3writefile("data5",1600);
  d3writefile("data6",3200);
}


int main(int argc, char** argv)
{

  test01();

  return 0;
}


