00001 #ifndef PCL_POLYNOMIAL_CALCULATIONS_H_
00002 #define POLYNOMIAL_CALCULATIONS_H_
00003
00004
00005
00006
00007 #include <Eigen/Core>
00008 #include <Eigen/Geometry>
00009 #include "pcl/common/bivariate_polynomial.h"
00010
00011 namespace pcl {
00012
00016 template <typename real>
00017 class PolynomialCalculationsT {
00018 public:
00019
00020 PolynomialCalculationsT ();
00021 ~PolynomialCalculationsT ();
00022
00023
00025 struct Parameters
00026 {
00027 Parameters () { setZeroValue (1e-6);}
00029 void
00030 setZeroValue (real new_zero_value);
00031 real zero_value;
00032 real sqr_zero_value;
00033 };
00034
00035
00038 inline void
00039 solveQuarticEquation (real a, real b, real c, real d, real e, std::vector<real>& roots) const;
00040
00043 inline void
00044 solveCubicEquation (real a, real b, real c, real d, std::vector<real>& roots) const;
00045
00048 inline void
00049 solveQuadraticEquation (real a, real b, real c, std::vector<real>& roots) const;
00050
00052 inline void
00053 solveLinearEquation (real a, real b, std::vector<real>& roots) const;
00054
00060 inline BivariatePolynomialT<real>
00061 bivariatePolynomialApproximation (std::vector<Eigen::Matrix<real, 3, 1> >& samplePoints,
00062 unsigned int polynomial_degree, bool& error) const;
00063
00065 inline bool
00066 bivariatePolynomialApproximation (std::vector<Eigen::Matrix<real, 3, 1> >& samplePoints,
00067 unsigned int polynomial_degree, BivariatePolynomialT<real>& ret) const;
00068
00070 inline void
00071 setZeroValue (real new_zero_value) { parameters_.setZeroValue(new_zero_value); }
00072
00073 protected:
00074
00076 inline bool
00077 isNearlyZero (real d) { return fabs (d)<parameters_.zero_value;}
00079 inline bool
00080 sqrtIsNearlyZero (real d) { return fabs (d)<parameters_.sqr_zero_value;}
00081
00082
00083 Parameters parameters_;
00084 };
00085
00086 typedef PolynomialCalculationsT<double> PolynomialCalculationsd;
00087 typedef PolynomialCalculationsT<float> PolynomialCalculations;
00088
00089 }
00090
00091 #include "pcl/common/polynomial_calculations.hpp"
00092
00093 #endif