Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef BSPLINE_DATA_INCLUDED
00030 #define BSPLINE_DATA_INCLUDED
00031
00032
00033 #include "ppolynomial.h"
00034
00035 namespace pcl
00036 {
00037 namespace poisson
00038 {
00039
00040
00041 template< int Degree , class Real >
00042 class BSplineData
00043 {
00044 bool useDotRatios;
00045 bool reflectBoundary;
00046 public:
00047 struct BSplineComponents
00048 {
00049 Polynomial< Degree > polys[Degree+1];
00050 Polynomial< Degree >& operator[] ( int idx ) { return polys[idx]; }
00051 const Polynomial< Degree >& operator[] ( int idx ) const { return polys[idx]; }
00052 void printnl( void ) const { for( int d=0 ; d<=Degree ; d++ ) polys[d].printnl(); }
00053 BSplineComponents scale( double s ) const { BSplineComponents b ; for( int d=0 ; d<=Degree ; d++ ) b[d] = polys[d].scale(s) ; return b; }
00054 BSplineComponents shift( double s ) const { BSplineComponents b ; for( int d=0 ; d<=Degree ; d++ ) b[d] = polys[d].shift(s) ; return b; }
00055 };
00056 const static int VV_DOT_FLAG = 1;
00057 const static int DV_DOT_FLAG = 2;
00058 const static int DD_DOT_FLAG = 4;
00059 const static int VALUE_FLAG = 1;
00060 const static int D_VALUE_FLAG = 2;
00061
00062 int depth , functionCount , sampleCount;
00063 Real *vvDotTable , *dvDotTable , *ddDotTable;
00064 Real *valueTables , *dValueTables;
00065 PPolynomial< Degree > baseFunction , leftBaseFunction , rightBaseFunction;
00066 PPolynomial< Degree-1 > dBaseFunction , dLeftBaseFunction , dRightBaseFunction;
00067 BSplineComponents baseBSpline, leftBSpline , rightBSpline;
00068 PPolynomial<Degree>* baseFunctions;
00069 BSplineComponents* baseBSplines;
00070
00071 BSplineData(void);
00072 ~BSplineData(void);
00073
00074 virtual void setDotTables( int flags );
00075 virtual void clearDotTables( int flags );
00076
00077 virtual void setValueTables( int flags,double smooth=0);
00078 virtual void setValueTables( int flags,double valueSmooth,double normalSmooth);
00079 virtual void clearValueTables(void);
00080
00081 void setSampleSpan( int idx , int& start , int& end , double smooth=0 ) const;
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 void set( int maxDepth , bool useDotRatios=true , bool reflectBoundary=false );
00093
00094 inline int Index( int i1 , int i2 ) const;
00095 static inline int SymmetricIndex( int i1 , int i2 );
00096 static inline int SymmetricIndex( int i1 , int i2 , int& index );
00097 };
00098
00099 template< int Degree >
00100 struct BSplineElementCoefficients
00101 {
00102 int coeffs[Degree+1];
00103 BSplineElementCoefficients( void ) { memset( coeffs , 0 , sizeof( int ) * ( Degree+1 ) ); }
00104 int& operator[]( int idx ){ return coeffs[idx]; }
00105 const int& operator[]( int idx ) const { return coeffs[idx]; }
00106 };
00107 template< int Degree >
00108 struct BSplineElements : public std::vector< BSplineElementCoefficients< Degree > >
00109 {
00110 static const int _off = (Degree+1)/2;
00111 void _addLeft ( int offset , int boundary );
00112 void _addRight( int offset , int boundary );
00113 public:
00114 enum
00115 {
00116 NONE = 0,
00117 DIRICHLET = -1,
00118 NEUMANN = 1
00119 };
00120
00121 int denominator;
00122
00123 BSplineElements( void ) { denominator = 1; }
00124 BSplineElements( int res , int offset , int boundary=NONE );
00125
00126 void upSample( BSplineElements& high ) const;
00127 void differentiate( BSplineElements< Degree-1 >& d ) const;
00128
00129 void print( FILE* fp=stdout ) const
00130 {
00131 for( int i=0 ; i<this->size() ; i++ )
00132 {
00133 printf( "%d]" , i );
00134 for( int j=0 ; j<=Degree ; j++ ) printf( " %d" , (*this)[i][j] );
00135 printf( " (%d)\n" , denominator );
00136 }
00137 }
00138 };
00139 template< int Degree1 , int Degree2 > void SetBSplineElementIntegrals( double integrals[Degree1+1][Degree2+1] );
00140
00141
00142 }
00143 }
00144
00145
00146 #include "bspline_data.hpp"
00147
00148 #endif // BSPLINE_DATA_INCLUDED