29 #ifndef BINARY_NODE_INCLUDED
30 #define BINARY_NODE_INCLUDED
32 #define MSVC_2010_FIX 1
39 static inline int CenterCount(
int depth ) {
return 1<<depth; }
40 static inline int CornerCount(
int depth ) {
return (1<<depth)+1; }
41 static inline int CumulativeCenterCount(
int maxDepth ) {
return (1<<(maxDepth+1))-1; }
42 static inline int CumulativeCornerCount(
int maxDepth ) {
return (1<<(maxDepth+1))+maxDepth; }
43 static inline int CenterIndex(
int depth ,
int offSet ) {
return (1<<depth)+offSet-1; }
44 static inline int CornerIndex(
int depth ,
int offSet ) {
return (1<<depth)+offSet+depth; }
46 static inline int CornerIndex(
int maxDepth ,
int depth ,
int offSet ,
int forwardCorner ){
return (offSet+forwardCorner)<<(maxDepth-depth); }
47 static inline Real CornerIndexPosition(
int index,
int maxDepth){
return Real(index)/(1<<maxDepth); }
48 static inline Real Width(
int depth){
return Real(1.0/(1<<depth)); }
49 static inline void CenterAndWidth(
int depth ,
int offset , Real& center , Real& width )
51 width=Real (1.0/(1<<depth) );
52 center=Real((0.5+offset)*width);
54 static inline void CenterAndWidth(
int idx , Real& center , Real& width )
57 DepthAndOffset( idx , depth , offset );
58 CenterAndWidth( depth , offset , center , width );
60 static inline void DepthAndOffset(
int idx ,
int& depth ,
int& offset )
65 #else // !MSVC_2010_FIX
67 #endif // MSVC_2010_FIX
75 #endif // MSVC_2010_FIX
76 offset = ( idx+1 ) - (1<<depth);
79 #endif // BINARY_NODE_INCLUDED