Point Cloud Library (PCL)  1.11.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
pcl::poisson::PPolynomial
Definition: ppolynomial.h:58
pcl
Definition: convolution.h:46
pcl::poisson::PPolynomial::set
void set(std::size_t size)
Definition: ppolynomial.hpp:121
pcl::poisson::PPolynomial::BSpline
static PPolynomial BSpline(double radius=0.5)
Definition: ppolynomial.hpp:391
pcl::poisson::Polynomial
Definition: polynomial.h:40
pcl::poisson::StartingPolynomial::Compare
static int Compare(const void *v1, const void *v2)
Definition: ppolynomial.hpp:76
pcl::poisson::PPolynomial::operator/=
PPolynomial & operator/=(double s)
Definition: ppolynomial.hpp:319
pcl::poisson::StartingPolynomial::start
double start
Definition: ppolynomial.h:47
pcl::poisson::PPolynomial::operator=
PPolynomial & operator=(const PPolynomial &p)
Definition: ppolynomial.hpp:140
pcl::poisson::PPolynomial::~PPolynomial
~PPolynomial(void)
Definition: ppolynomial.hpp:100
pcl::poisson::PPolynomial::MovingAverage
PPolynomial< Degree+1 > MovingAverage(double radius)
Definition: ppolynomial.hpp:396
pcl::poisson::PPolynomial::operator*=
PPolynomial & operator*=(double s)
Definition: ppolynomial.hpp:313
pcl::poisson::StartingPolynomial::operator<
int operator<(const StartingPolynomial &sp) const
Definition: ppolynomial.hpp:71
pcl::poisson::PPolynomial::operator*
PPolynomial< Degree+Degree2 > operator*(const Polynomial< Degree2 > &p) const
Definition: ppolynomial.hpp:261
pcl::poisson::PPolynomial::getSolutions
void getSolutions(double c, std::vector< double > &roots, double EPS, double min=-DBL_MAX, double max=DBL_MAX) const
Definition: ppolynomial.hpp:416
pcl::poisson::PPolynomial::integral
PPolynomial< Degree+1 > integral(void) const
Definition: ppolynomial.hpp:297
pcl::poisson::PPolynomial::polyCount
std::size_t polyCount
Definition: ppolynomial.h:61
pcl::poisson::PPolynomial::write
void write(FILE *fp, int samples, double min, double max) const
Definition: ppolynomial.hpp:435
pcl::poisson::StartingPolynomial::shift
StartingPolynomial shift(double t) const
Definition: ppolynomial.hpp:62
pcl::poisson::PPolynomial::operator+
PPolynomial operator+(const PPolynomial &p) const
Definition: ppolynomial.hpp:187
pcl::poisson::PPolynomial::size
int size(void) const
Definition: ppolynomial.hpp:118
pcl::poisson::StartingPolynomial::operator*
StartingPolynomial< Degree+Degree2 > operator*(const StartingPolynomial< Degree2 > &p) const
Definition: ppolynomial.hpp:47
pcl::poisson::PPolynomial::operator-=
PPolynomial & operator-=(double s)
Definition: ppolynomial.hpp:311
pcl::poisson::PPolynomial::PPolynomial
PPolynomial(void)
Definition: ppolynomial.hpp:87
pcl::poisson::PPolynomial::shift
PPolynomial shift(double t) const
Definition: ppolynomial.hpp:279
pcl::poisson::StartingPolynomial::p
Polynomial< Degree > p
Definition: ppolynomial.h:46
pcl::poisson::PPolynomial::reset
void reset(std::size_t newSize)
Definition: ppolynomial.hpp:133
pcl::poisson::PPolynomial::derivative
PPolynomial< Degree-1 > derivative(void) const
Definition: ppolynomial.hpp:287
pcl::poisson::PPolynomial::operator+=
PPolynomial & operator+=(double s)
Definition: ppolynomial.hpp:309
pcl::poisson::PPolynomial::Integral
double Integral(void) const
Definition: ppolynomial.hpp:185
pcl::poisson::PPolynomial::operator-
PPolynomial operator-(const PPolynomial &p) const
Definition: ppolynomial.hpp:204
pcl::poisson::StartingPolynomial
Definition: ppolynomial.h:44
pcl::poisson::PPolynomial::operator()
double operator()(double t) const
Definition: ppolynomial.hpp:158
pcl::poisson::PPolynomial::polys
StartingPolynomial< Degree > * polys
Definition: ppolynomial.h:62
pcl::poisson::PPolynomial::operator/
PPolynomial operator/(double s) const
Definition: ppolynomial.hpp:346
pcl::poisson::StartingPolynomial::scale
StartingPolynomial scale(double s) const
Definition: ppolynomial.hpp:55
pcl::poisson::PPolynomial::printnl
void printnl(void) const
Definition: ppolynomial.hpp:354
pcl::poisson::PPolynomial::scale
PPolynomial scale(double s) const
Definition: ppolynomial.hpp:271
pcl::poisson::PPolynomial::addScaled
PPolynomial & addScaled(const PPolynomial &poly, double scale)
Definition: ppolynomial.hpp:221