Point Cloud Library (PCL)
1.3.1
|
00001 #ifndef BIVARIATE_POLYNOMIAL_H 00002 #define BIVARIATE_POLYNOMIAL_H 00003 00004 #include <fstream> 00005 #include <iostream> 00006 00007 namespace pcl 00008 { 00013 template<typename real> 00014 class BivariatePolynomialT 00015 { 00016 public: 00017 //-----CONSTRUCTOR&DESTRUCTOR----- 00019 BivariatePolynomialT (int new_degree=0); 00021 BivariatePolynomialT (const BivariatePolynomialT& other); 00023 ~BivariatePolynomialT (); 00024 00025 //-----OPERATORS----- 00027 BivariatePolynomialT& 00028 operator= (const BivariatePolynomialT& other) { deepCopy (other); return *this;} 00029 00030 //-----METHODS----- 00032 void 00033 setDegree (int new_degree); 00034 00036 unsigned int 00037 getNoOfParameters () const { return getNoOfParametersFromDegree (degree);} 00038 00040 real 00041 getValue (real x, real y) const; 00042 00045 void 00046 calculateGradient (bool forceRecalc=false); 00047 00049 void 00050 getValueOfGradient (real x, real y, real& gradX, real& gradY); 00051 00054 void 00055 findCriticalPoints (std::vector<real>& x_values, std::vector<real>& y_values, std::vector<int>& types) const; 00056 00058 void 00059 writeBinary (std::ostream& os) const; 00060 00062 void 00063 writeBinary (const char* filename) const; 00064 00066 void 00067 readBinary (std::istream& os); 00068 00070 void 00071 readBinary (const char* filename); 00072 00074 static unsigned int 00075 getNoOfParametersFromDegree (int n) { return ((n+2)* (n+1))/2;} 00076 00077 //-----VARIABLES----- 00078 int degree; 00079 real* parameters; 00080 BivariatePolynomialT<real>* gradient_x, * gradient_y; 00081 00082 protected: 00083 //-----METHODS----- 00085 void 00086 memoryCleanUp (); 00087 00089 void 00090 deepCopy (const BivariatePolynomialT<real>& other); 00091 //-----VARIABLES----- 00092 }; 00093 00094 template<typename real> 00095 std::ostream& 00096 operator<< (std::ostream& os, const BivariatePolynomialT<real>& p); 00097 00098 typedef BivariatePolynomialT<double> BivariatePolynomiald; 00099 typedef BivariatePolynomialT<float> BivariatePolynomial; 00100 00101 } // end namespace 00102 00103 #include "pcl/common/impl/bivariate_polynomial.hpp" 00104 00105 #endif