polynomial.h
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2006, Michael Kazhdan and Matthew Bolitho
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without modification,
00006 are permitted provided that the following conditions are met:
00007 
00008 Redistributions of source code must retain the above copyright notice, this list of
00009 conditions and the following disclaimer. Redistributions in binary form must reproduce
00010 the above copyright notice, this list of conditions and the following disclaimer
00011 in the documentation and/or other materials provided with the distribution. 
00012 
00013 Neither the name of the Johns Hopkins University nor the names of its contributors
00014 may be used to endorse or promote products derived from this software without specific
00015 prior written permission. 
00016 
00017 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
00018 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
00019 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00020 SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00021 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00022 TO, PROCUREMENT OF SUBSTITUTE  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
00023 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00024 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00025 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00026 DAMAGE.
00027 */
00028 
00029 #ifndef POLYNOMIAL_INCLUDED
00030 #define POLYNOMIAL_INCLUDED
00031 
00032 #include <vector>
00033 
00034 namespace pcl
00035 {
00036   namespace poisson
00037   {
00038 
00039     template< int Degree >
00040     class Polynomial{
00041       public:
00042         double coefficients[Degree+1];
00043 
00044         Polynomial(void);
00045         template<int Degree2>
00046         Polynomial(const Polynomial<Degree2>& P);
00047         double operator()( double t ) const;
00048         double integral( double tMin , double tMax ) const;
00049 
00050         int operator == (const Polynomial& p) const;
00051         int operator != (const Polynomial& p) const;
00052         int isZero(void) const;
00053         void setZero(void);
00054 
00055         template<int Degree2>
00056         Polynomial& operator  = (const Polynomial<Degree2> &p);
00057         Polynomial& operator += (const Polynomial& p);
00058         Polynomial& operator -= (const Polynomial& p);
00059         Polynomial  operator -  (void) const;
00060         Polynomial  operator +  (const Polynomial& p) const;
00061         Polynomial  operator -  (const Polynomial& p) const;
00062         template<int Degree2>
00063         Polynomial<Degree+Degree2>  operator *  (const Polynomial<Degree2>& p) const;
00064 
00065         Polynomial& operator += ( double s );
00066         Polynomial& operator -= ( double s );
00067         Polynomial& operator *= ( double s );
00068         Polynomial& operator /= ( double s );
00069         Polynomial  operator +  ( double s ) const;
00070         Polynomial  operator -  ( double s ) const;
00071         Polynomial  operator *  ( double s ) const;
00072         Polynomial  operator /  ( double s ) const;
00073 
00074         Polynomial scale( double s ) const;
00075         Polynomial shift( double t ) const;
00076 
00077         Polynomial<Degree-1> derivative(void) const;
00078         Polynomial<Degree+1> integral(void) const;
00079 
00080         void printnl(void) const;
00081 
00082         Polynomial& addScaled(const Polynomial& p,double scale);
00083 
00084         static void Negate(const Polynomial& in,Polynomial& out);
00085         static void Subtract(const Polynomial& p1,const Polynomial& p2,Polynomial& q);
00086         static void Scale(const Polynomial& p,double w,Polynomial& q);
00087         static void AddScaled(const Polynomial& p1,double w1,const Polynomial& p2,double w2,Polynomial& q);
00088         static void AddScaled(const Polynomial& p1,const Polynomial& p2,double w2,Polynomial& q);
00089         static void AddScaled(const Polynomial& p1,double w1,const Polynomial& p2,Polynomial& q);
00090 
00091         void getSolutions(double c,std::vector<double>& roots,double EPS) const;
00092 
00093         static Polynomial BSplineComponent( int i );
00094     };
00095 
00096 
00097   }
00098 }
00099 
00100 
00101 #include "polynomial.hpp"
00102 #endif // POLYNOMIAL_INCLUDED


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:31:11