Point Cloud Library (PCL)  1.14.1-dev
function_data.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 FUNCTION_DATA_INCLUDED
30 #define FUNCTION_DATA_INCLUDED
31 
32 #define BOUNDARY_CONDITIONS 1
33 
34 #if defined __GNUC__
35 # pragma GCC system_header
36 #endif
37 
38 
39 #include "ppolynomial.h"
40 
41 namespace pcl
42 {
43  namespace poisson
44  {
45 
46  template<int Degree,class Real>
47  class FunctionData{
48  bool useDotRatios;
49  int normalize;
50 #if BOUNDARY_CONDITIONS
51  bool reflectBoundary;
52 #endif // BOUNDARY_CONDITIONS
53  public:
54  const static int DOT_FLAG = 1;
55  const static int D_DOT_FLAG = 2;
56  const static int D2_DOT_FLAG = 4;
57  const static int VALUE_FLAG = 1;
58  const static int D_VALUE_FLAG = 2;
59 
60  int depth , res , res2;
63 #if BOUNDARY_CONDITIONS
66 #else // !BOUNDARY_CONDITIONS
68  PPolynomial<Degree-1> dBaseFunction;
69 #endif // BOUNDARY_CONDITIONS
71 
72  FunctionData(void);
73  ~FunctionData(void);
74 
75  virtual void setDotTables(const int& flags);
76  virtual void clearDotTables(const int& flags);
77 
78  virtual void setValueTables(const int& flags,const double& smooth=0);
79  virtual void setValueTables(const int& flags,const double& valueSmooth,const double& normalSmooth);
80  virtual void clearValueTables(void);
81 
82  /********************************************************
83  * Sets the translates and scales of the basis function
84  * up to the prescribed depth
85  * <maxDepth> the maximum depth
86  * <F> the basis function
87  * <normalize> how the functions should be scaled
88  * 0] Value at zero equals 1
89  * 1] Integral equals 1
90  * 2] L2-norm equals 1
91  * <useDotRatios> specifies if dot-products of derivatives
92  * should be pre-divided by function integrals
93  * <reflectBoundary> spcifies if function space should be
94  * forced to be reflectively symmetric across the boundary
95  ********************************************************/
96 #if BOUNDARY_CONDITIONS
97  void set( const int& maxDepth , const PPolynomial<Degree>& F , const int& normalize , bool useDotRatios=true , bool reflectBoundary=false );
98 #else // !BOUNDARY_CONDITIONS
99  void set(const int& maxDepth,const PPolynomial<Degree>& F,const int& normalize , bool useDotRatios=true );
100 #endif // BOUNDARY_CONDITIONS
101 
102 #if BOUNDARY_CONDITIONS
103  Real dotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 , int boundary1 , int boundary2 ) const;
104  Real dDotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 , int boundary1 , int boundary2 ) const;
105  Real d2DotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 , int boundary1 , int boundary2 ) const;
106 #else // !BOUNDARY_CONDITIONS
107  Real dotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 ) const;
108  Real dDotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 ) const;
109  Real d2DotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 ) const;
110 #endif // BOUNDARY_CONDITIONS
111 
112  static inline int SymmetricIndex( const int& i1 , const int& i2 );
113  static inline int SymmetricIndex( const int& i1 , const int& i2 , int& index );
114  };
115 
116 
117  }
118 }
119 
120 
121 #include "function_data.hpp"
122 
123 #endif // FUNCTION_DATA_INCLUDED
virtual void setDotTables(const int &flags)
static const int D_VALUE_FLAG
Definition: function_data.h:58
PPolynomial< Degree > baseFunction
Definition: function_data.h:64
PPolynomial< Degree > rightBaseFunction
Definition: function_data.h:64
static const int DOT_FLAG
Definition: function_data.h:54
PPolynomial< Degree-1 > dRightBaseFunction
Definition: function_data.h:65
static const int D_DOT_FLAG
Definition: function_data.h:55
PPolynomial< Degree-1 > dBaseFunction
Definition: function_data.h:65
virtual void clearValueTables(void)
PPolynomial< Degree+1 > * baseFunctions
Definition: function_data.h:70
static const int VALUE_FLAG
Definition: function_data.h:57
Real dDotProduct(const double &center1, const double &width1, const double &center2, const double &width2, int boundary1, int boundary2) const
static const int D2_DOT_FLAG
Definition: function_data.h:56
PPolynomial< Degree-1 > dLeftBaseFunction
Definition: function_data.h:65
static int SymmetricIndex(const int &i1, const int &i2)
PPolynomial< Degree > leftBaseFunction
Definition: function_data.h:64
virtual void setValueTables(const int &flags, const double &smooth=0)
void set(const int &maxDepth, const PPolynomial< Degree > &F, const int &normalize, bool useDotRatios=true, bool reflectBoundary=false)
Real d2DotProduct(const double &center1, const double &width1, const double &center2, const double &width2, int boundary1, int boundary2) const
Real dotProduct(const double &center1, const double &width1, const double &center2, const double &width2, int boundary1, int boundary2) const
virtual void clearDotTables(const int &flags)