00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: piecewisePolynomial.h,v 1.19 2005/12/23 17:01:48 amoll Exp $ 00005 // 00006 00007 #ifndef BALL_MATHS_PPOLYNOMIAL_H 00008 #define BALL_MATHS_PPOLYNOMIAL_H 00009 00010 #ifndef BALL_MATHS_PIECEWISEFUNCTION_H 00011 # include <BALL/MATHS/piecewiseFunction.h> 00012 #endif 00013 00014 namespace BALL 00015 { 00027 class BALL_EXPORT PiecewisePolynomial 00028 : public PiecewiseFunction 00029 { 00030 public: 00031 00032 BALL_CREATE(PiecewisePolynomial) 00033 00034 00037 00040 PiecewisePolynomial(); 00041 00044 PiecewisePolynomial(const PiecewisePolynomial& polynomial) ; 00045 00049 PiecewisePolynomial(Size degree, const std::vector<Interval>& intervals, 00050 const std::vector<Coefficients>& coefficients) ; 00051 00054 virtual ~PiecewisePolynomial(); 00055 00057 00060 00063 PiecewisePolynomial& operator = (const PiecewisePolynomial& poly); 00064 00067 virtual void clear(); 00068 00070 00073 00076 void set(Size degree, const std::vector<Interval>& intervals, const std::vector<Coefficients>& coeffs); 00077 00079 void setDegree(Size degree); 00080 00082 Size getDegree() const; 00083 00085 virtual double operator () (double x) const; 00086 00088 00091 00094 bool operator == (const PiecewisePolynomial& poly) const; 00095 00097 00100 00103 virtual void dump (std::ostream& s = std::cout, Size depth = 0) const; 00104 00106 00107 protected: 00108 00109 /*_ The degree of the polynomial 00110 */ 00111 Size degree_; 00112 00113 }; 00114 00115 } 00116 00117 #endif // BALL_MATHS_PPPOLYNOMIAL_H