#ifndef D2FUNC_H
#define D2FUNC_H

#include <point.h>

//
//  Brief:  A function takes an argument and returns a value.
//          This class takes a 2D point and makes a 3D point. 
class d2func
{
public:

  // Destructor
  virtual ~d2func() {}

  // Clients derive d2func and define the function here.
  virtual double const eval(point2<double> const & X) const=0;

  // Make a 3D point from a point on the 2D surface.
  point3<double> const make(double const x, double const y) const 
    { return point3<double>(x,y,this->eval( point2<double>(x,y) ) ); }

  // Make a 3D point from a point on the 2D surface.
  point3<double> const make(point2<double> const & x) const
    { return make(x.x,x.y); }

};

#endif


