Point Cloud Library (PCL)
1.7.0
|
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 FUNCTION_DATA_INCLUDED 00030 #define FUNCTION_DATA_INCLUDED 00031 00032 #define BOUNDARY_CONDITIONS 1 00033 00034 #if defined __GNUC__ 00035 # pragma GCC system_header 00036 #endif 00037 00038 00039 #include "ppolynomial.h" 00040 00041 namespace pcl 00042 { 00043 namespace poisson 00044 { 00045 00046 template<int Degree,class Real> 00047 class FunctionData{ 00048 bool useDotRatios; 00049 int normalize; 00050 #if BOUNDARY_CONDITIONS 00051 bool reflectBoundary; 00052 #endif // BOUNDARY_CONDITIONS 00053 public: 00054 const static int DOT_FLAG = 1; 00055 const static int D_DOT_FLAG = 2; 00056 const static int D2_DOT_FLAG = 4; 00057 const static int VALUE_FLAG = 1; 00058 const static int D_VALUE_FLAG = 2; 00059 00060 int depth , res , res2; 00061 Real *dotTable , *dDotTable , *d2DotTable; 00062 Real *valueTables , *dValueTables; 00063 #if BOUNDARY_CONDITIONS 00064 PPolynomial<Degree> baseFunction , leftBaseFunction , rightBaseFunction; 00065 PPolynomial<Degree-1> dBaseFunction , dLeftBaseFunction , dRightBaseFunction; 00066 #else // !BOUNDARY_CONDITIONS 00067 PPolynomial<Degree> baseFunction; 00068 PPolynomial<Degree-1> dBaseFunction; 00069 #endif // BOUNDARY_CONDITIONS 00070 PPolynomial<Degree+1>* baseFunctions; 00071 00072 FunctionData(void); 00073 ~FunctionData(void); 00074 00075 virtual void setDotTables(const int& flags); 00076 virtual void clearDotTables(const int& flags); 00077 00078 virtual void setValueTables(const int& flags,const double& smooth=0); 00079 virtual void setValueTables(const int& flags,const double& valueSmooth,const double& normalSmooth); 00080 virtual void clearValueTables(void); 00081 00082 /******************************************************** 00083 * Sets the translates and scales of the basis function 00084 * up to the prescribed depth 00085 * <maxDepth> the maximum depth 00086 * <F> the basis function 00087 * <normalize> how the functions should be scaled 00088 * 0] Value at zero equals 1 00089 * 1] Integral equals 1 00090 * 2] L2-norm equals 1 00091 * <useDotRatios> specifies if dot-products of derivatives 00092 * should be pre-divided by function integrals 00093 * <reflectBoundary> spcifies if function space should be 00094 * forced to be reflectively symmetric across the boundary 00095 ********************************************************/ 00096 #if BOUNDARY_CONDITIONS 00097 void set( const int& maxDepth , const PPolynomial<Degree>& F , const int& normalize , bool useDotRatios=true , bool reflectBoundary=false ); 00098 #else // !BOUNDARY_CONDITIONS 00099 void set(const int& maxDepth,const PPolynomial<Degree>& F,const int& normalize , bool useDotRatios=true ); 00100 #endif // BOUNDARY_CONDITIONS 00101 00102 #if BOUNDARY_CONDITIONS 00103 Real dotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 , int boundary1 , int boundary2 ) const; 00104 Real dDotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 , int boundary1 , int boundary2 ) const; 00105 Real d2DotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 , int boundary1 , int boundary2 ) const; 00106 #else // !BOUNDARY_CONDITIONS 00107 Real dotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 ) const; 00108 Real dDotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 ) const; 00109 Real d2DotProduct( const double& center1 , const double& width1 , const double& center2 , const double& width2 ) const; 00110 #endif // BOUNDARY_CONDITIONS 00111 00112 static inline int SymmetricIndex( const int& i1 , const int& i2 ); 00113 static inline int SymmetricIndex( const int& i1 , const int& i2 , int& index ); 00114 }; 00115 00116 00117 } 00118 } 00119 00120 00121 #include "function_data.hpp" 00122 00123 #endif // FUNCTION_DATA_INCLUDED