Point Cloud Library (PCL)  1.14.1-dev
ppolynomial.h
1 /*
2 Copyright (c) 2006, Michael Kazhdan and Matthew Bolitho
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
7 
8 Redistributions of source code must retain the above copyright notice, this list of
9 conditions and the following disclaimer. Redistributions in binary form must reproduce
10 the above copyright notice, this list of conditions and the following disclaimer
11 in the documentation and/or other materials provided with the distribution.
12 
13 Neither the name of the Johns Hopkins University nor the names of its contributors
14 may be used to endorse or promote products derived from this software without specific
15 prior written permission.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES
19 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
20 SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26 DAMAGE.
27 */
28 
29 #ifndef P_POLYNOMIAL_INCLUDED
30 #define P_POLYNOMIAL_INCLUDED
31 
32 #if defined __GNUC__
33 # pragma GCC system_header
34 #endif
35 
36 #include <vector>
37 #include "polynomial.h"
38 
39 namespace pcl
40 {
41  namespace poisson
42  {
43  template<int Degree>
45  public:
47  double start;
48 
49  template<int Degree2>
51  StartingPolynomial scale(double s) const;
52  StartingPolynomial shift(double t) const;
53  int operator < (const StartingPolynomial& sp) const;
54  static int Compare(const void* v1,const void* v2);
55  };
56 
57  template<int Degree>
59  {
60  public:
61  std::size_t polyCount;
63 
64  PPolynomial(void);
66  ~PPolynomial(void);
67 
69 
70  int size(void) const;
71 
72  void set( std::size_t size );
73  // Note: this method will sort the elements in sps
74  void set( StartingPolynomial<Degree>* sps , int count );
75  void reset( std::size_t newSize );
76 
77 
78  double operator()( double t ) const;
79  double integral( double tMin , double tMax ) const;
80  double Integral( void ) const;
81 
82  template<int Degree2>
84 
85  PPolynomial operator + (const PPolynomial& p) const;
86  PPolynomial operator - (const PPolynomial& p) const;
87 
88  template<int Degree2>
90 
91  template<int Degree2>
93 
94 
95  PPolynomial& operator += ( double s );
96  PPolynomial& operator -= ( double s );
97  PPolynomial& operator *= ( double s );
98  PPolynomial& operator /= ( double s );
99  PPolynomial operator + ( double s ) const;
100  PPolynomial operator - ( double s ) const;
101  PPolynomial operator * ( double s ) const;
102  PPolynomial operator / ( double s ) const;
103 
104  PPolynomial& addScaled(const PPolynomial& poly,double scale);
105 
106  PPolynomial scale( double s ) const;
107  PPolynomial shift( double t ) const;
108 
109  PPolynomial< Degree-1 > derivative(void) const;
110  PPolynomial< Degree+1 > integral(void) const;
111 
112  void getSolutions(double c,std::vector<double>& roots,double EPS,double min=-DBL_MAX,double max=DBL_MAX) const;
113 
114  void printnl( void ) const;
115 
116  PPolynomial< Degree+1 > MovingAverage( double radius );
117  static PPolynomial BSpline( double radius=0.5 );
118 
119  void write( FILE* fp , int samples , double min , double max ) const;
120  };
121 
122 
123  }
124 }
125 
126 
127 #include "ppolynomial.hpp"
128 #endif // P_POLYNOMIAL_INCLUDED
PPolynomial operator-(const PPolynomial &p) const
PPolynomial operator/(double s) const
StartingPolynomial< Degree > * polys
Definition: ppolynomial.h:62
PPolynomial & operator-=(double s)
PPolynomial shift(double t) const
void getSolutions(double c, std::vector< double > &roots, double EPS, double min=-DBL_MAX, double max=DBL_MAX) const
PPolynomial & operator=(const PPolynomial &p)
double operator()(double t) const
PPolynomial & operator+=(double s)
PPolynomial & operator/=(double s)
PPolynomial & operator*=(double s)
void write(FILE *fp, int samples, double min, double max) const
void reset(std::size_t newSize)
PPolynomial operator+(const PPolynomial &p) const
PPolynomial scale(double s) const
PPolynomial< Degree+1 > integral(void) const
static PPolynomial BSpline(double radius=0.5)
PPolynomial< Degree+Degree2 > operator*(const Polynomial< Degree2 > &p) const
void set(std::size_t size)
PPolynomial & addScaled(const PPolynomial &poly, double scale)
void printnl(void) const
PPolynomial< Degree-1 > derivative(void) const
PPolynomial< Degree+1 > MovingAverage(double radius)
double Integral(void) const
StartingPolynomial shift(double t) const
Definition: ppolynomial.hpp:62
Polynomial< Degree > p
Definition: ppolynomial.h:46
StartingPolynomial< Degree+Degree2 > operator*(const StartingPolynomial< Degree2 > &p) const
Definition: ppolynomial.hpp:47
StartingPolynomial scale(double s) const
Definition: ppolynomial.hpp:55
int operator<(const StartingPolynomial &sp) const
Definition: ppolynomial.hpp:71
static int Compare(const void *v1, const void *v2)
Definition: ppolynomial.hpp:76