ppolynomial.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 P_POLYNOMIAL_INCLUDED
00030 #define P_POLYNOMIAL_INCLUDED
00031 
00032 #if defined __GNUC__
00033 #  pragma GCC system_header
00034 #endif
00035 
00036 #include <vector>
00037 #include "polynomial.h"
00038 
00039 namespace pcl
00040 {
00041   namespace poisson
00042   {
00043     template<int Degree>
00044     class StartingPolynomial{
00045       public:
00046         Polynomial<Degree> p;
00047         double start;
00048 
00049         template<int Degree2>
00050         StartingPolynomial<Degree+Degree2>  operator * (const StartingPolynomial<Degree2>& p) const;
00051         StartingPolynomial scale(double s) const;
00052         StartingPolynomial shift(double t) const;
00053         int operator < (const StartingPolynomial& sp) const;
00054         static int Compare(const void* v1,const void* v2);
00055     };
00056 
00057     template<int Degree>
00058     class PPolynomial
00059     {
00060       public:
00061         size_t polyCount;
00062         StartingPolynomial<Degree>* polys;
00063 
00064         PPolynomial(void);
00065         PPolynomial(const PPolynomial<Degree>& p);
00066         ~PPolynomial(void);
00067 
00068         PPolynomial& operator = (const PPolynomial& p);
00069 
00070         int size(void) const;
00071 
00072         void set( size_t size );
00073         // Note: this method will sort the elements in sps
00074         void set( StartingPolynomial<Degree>* sps , int count );
00075         void reset( size_t newSize );
00076 
00077 
00078         double operator()( double t ) const;
00079         double integral( double tMin , double tMax ) const;
00080         double Integral( void ) const;
00081 
00082         template<int Degree2>
00083         PPolynomial<Degree>& operator = (const PPolynomial<Degree2>& p);
00084 
00085         PPolynomial  operator + (const PPolynomial& p) const;
00086         PPolynomial  operator - (const PPolynomial& p) const;
00087 
00088         template<int Degree2>
00089         PPolynomial<Degree+Degree2> operator * (const Polynomial<Degree2>& p) const;
00090 
00091         template<int Degree2>
00092         PPolynomial<Degree+Degree2> operator * (const PPolynomial<Degree2>& p) const;
00093 
00094 
00095         PPolynomial& operator += ( double s );
00096         PPolynomial& operator -= ( double s );
00097         PPolynomial& operator *= ( double s );
00098         PPolynomial& operator /= ( double s );
00099         PPolynomial  operator +  ( double s ) const;
00100         PPolynomial  operator -  ( double s ) const;
00101         PPolynomial  operator *  ( double s ) const;
00102         PPolynomial  operator /  ( double s ) const;
00103 
00104         PPolynomial& addScaled(const PPolynomial& poly,double scale);
00105 
00106         PPolynomial scale( double s ) const;
00107         PPolynomial shift( double t ) const;
00108 
00109         PPolynomial< Degree-1 > derivative(void) const;
00110         PPolynomial< Degree+1 > integral(void) const;
00111 
00112         void getSolutions(double c,std::vector<double>& roots,double EPS,double min=-DBL_MAX,double max=DBL_MAX) const;
00113 
00114         void printnl( void ) const;
00115 
00116         PPolynomial< Degree+1 > MovingAverage( double radius );
00117         static PPolynomial BSpline( double radius=0.5 );
00118 
00119         void write( FILE* fp , int samples , double min , double max ) const;
00120     };
00121 
00122 
00123   }
00124 }
00125 
00126 
00127 #include "ppolynomial.hpp"
00128 #endif // P_POLYNOMIAL_INCLUDED


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