Point Cloud Library (PCL) 1.12.0
Loading...
Searching...
No Matches
polynomial.h
1/*
2Copyright (c) 2006, Michael Kazhdan and Matthew Bolitho
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without modification,
6are permitted provided that the following conditions are met:
7
8Redistributions of source code must retain the above copyright notice, this list of
9conditions and the following disclaimer. Redistributions in binary form must reproduce
10the above copyright notice, this list of conditions and the following disclaimer
11in the documentation and/or other materials provided with the distribution.
12
13Neither the name of the Johns Hopkins University nor the names of its contributors
14may be used to endorse or promote products derived from this software without specific
15prior written permission.
16
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
18EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES
19OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
20SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26DAMAGE.
27*/
28
29#ifndef POLYNOMIAL_INCLUDED
30#define POLYNOMIAL_INCLUDED
31
32#include <vector>
33
34namespace pcl
35{
36 namespace poisson
37 {
38
39 template< int Degree >
41 public:
42 double coefficients[Degree+1];
43
44 Polynomial(void);
45 template<int Degree2>
47 double operator()( double t ) const;
48 double integral( double tMin , double tMax ) const;
49
50 int operator == (const Polynomial& p) const;
51 int operator != (const Polynomial& p) const;
52 int isZero(void) const;
53 void setZero(void);
54
55 template<int Degree2>
59 Polynomial operator - (void) const;
60 Polynomial operator + (const Polynomial& p) const;
61 Polynomial operator - (const Polynomial& p) const;
62 template<int Degree2>
64
65 Polynomial& operator += ( double s );
66 Polynomial& operator -= ( double s );
67 Polynomial& operator *= ( double s );
68 Polynomial& operator /= ( double s );
69 Polynomial operator + ( double s ) const;
70 Polynomial operator - ( double s ) const;
71 Polynomial operator * ( double s ) const;
72 Polynomial operator / ( double s ) const;
73
74 Polynomial scale( double s ) const;
75 Polynomial shift( double t ) const;
76
77 Polynomial<Degree-1> derivative(void) const;
79
80 void printnl(void) const;
81
82 Polynomial& addScaled(const Polynomial& p,double scale);
83
84 static void Negate(const Polynomial& in,Polynomial& out);
85 static void Subtract(const Polynomial& p1,const Polynomial& p2,Polynomial& q);
86 static void Scale(const Polynomial& p,double w,Polynomial& q);
87 static void AddScaled(const Polynomial& p1,double w1,const Polynomial& p2,double w2,Polynomial& q);
88 static void AddScaled(const Polynomial& p1,const Polynomial& p2,double w2,Polynomial& q);
89 static void AddScaled(const Polynomial& p1,double w1,const Polynomial& p2,Polynomial& q);
90
91 void getSolutions(double c,std::vector<double>& roots,double EPS) const;
92
93 static Polynomial BSplineComponent( int i );
94 };
95
96
97 }
98}
99
100
101#include "polynomial.hpp"
102#endif // POLYNOMIAL_INCLUDED
Polynomial & operator=(const Polynomial< Degree2 > &p)
Polynomial & operator+=(const Polynomial &p)
static void Negate(const Polynomial &in, Polynomial &out)
Polynomial scale(double s) const
Polynomial< Degree+1 > integral(void) const
Polynomial shift(double t) const
void getSolutions(double c, std::vector< double > &roots, double EPS) const
double operator()(double t) const
int operator!=(const Polynomial &p) const
static void AddScaled(const Polynomial &p1, double w1, const Polynomial &p2, double w2, Polynomial &q)
static void Scale(const Polynomial &p, double w, Polynomial &q)
Polynomial operator-(void) const
Polynomial< Degree-1 > derivative(void) const
Polynomial & operator/=(double s)
void printnl(void) const
Polynomial & operator*=(double s)
Polynomial & operator-=(const Polynomial &p)
Polynomial operator/(double s) const
double coefficients[Degree+1]
Definition polynomial.h:42
int operator==(const Polynomial &p) const
static void Subtract(const Polynomial &p1, const Polynomial &p2, Polynomial &q)
static Polynomial BSplineComponent(int i)
Polynomial & addScaled(const Polynomial &p, double scale)
Polynomial operator+(const Polynomial &p) const
Polynomial< Degree+Degree2 > operator*(const Polynomial< Degree2 > &p) const