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 BINARY_NODE_INCLUDED
00030 #define BINARY_NODE_INCLUDED
00031
00032 #define MSVC_2010_FIX 1
00033
00034 namespace pcl
00035 {
00036 namespace poisson
00037 {
00038 template<class Real>
00039 class BinaryNode
00040 {
00041 public:
00042 static inline int CenterCount( int depth ) { return 1<<depth; }
00043 static inline int CornerCount( int depth ) { return (1<<depth)+1; }
00044 static inline int CumulativeCenterCount( int maxDepth ) { return (1<<(maxDepth+1))-1; }
00045 static inline int CumulativeCornerCount( int maxDepth ) { return (1<<(maxDepth+1))+maxDepth; }
00046 static inline int Index( int depth , int offSet ) { return (1<<depth)+offSet-1; }
00047 static inline int CenterIndex( int depth , int offSet ) { return (1<<depth)+offSet-1; }
00048 static inline int CornerIndex( int depth , int offSet ) { return (1<<depth)+offSet+depth; }
00049
00050 static inline int CornerIndex( int maxDepth , int depth , int offSet , int forwardCorner ){ return (offSet+forwardCorner)<<(maxDepth-depth); }
00051 static inline Real CornerIndexPosition(int index,int maxDepth){ return Real(index)/(1<<maxDepth); }
00052 static inline Real Width(int depth){ return Real(1.0/(1<<depth)); }
00053 static inline void CenterAndWidth( int depth , int offset , Real& center , Real& width )
00054 {
00055 width=Real (1.0/(1<<depth) );
00056 center=Real((0.5+offset)*width);
00057 }
00058 static inline void CenterAndWidth( int idx , Real& center , Real& width )
00059 {
00060 int depth , offset;
00061 DepthAndOffset( idx , depth , offset );
00062 CenterAndWidth( depth , offset , center , width );
00063 }
00064 static inline void DepthAndOffset( int idx , int& depth , int& offset )
00065 {
00066 int i=idx+1;
00067 #if MSVC_2010_FIX
00068 depth = 0;
00069 #else // !MSVC_2010_FIX
00070 depth = -1;
00071 #endif // MSVC_2010_FIX
00072 while( i )
00073 {
00074 i >>= 1;
00075 depth++;
00076 }
00077 #if MSVC_2010_FIX
00078 depth--;
00079 #endif // MSVC_2010_FIX
00080 offset = ( idx+1 ) - (1<<depth);
00081 }
00082 };
00083
00084
00085 }
00086 }
00087
00088 #endif // BINARY_NODE_INCLUDED