Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __LEVEL_HELPERS_H
00010 #define __LEVEL_HELPERS_H
00011 #include <TooN/TooN.h>
00012 using namespace TooN;
00013 #include <cvd/image_ref.h>
00014
00015
00016 extern Vector<3> gavLevelColors[];
00017
00018
00019
00020 inline int LevelScale(int nLevel)
00021 {
00022 return 1 << nLevel;
00023 }
00024
00025
00026 inline double LevelZeroPos(double dLevelPos, int nLevel)
00027 {
00028 return (dLevelPos + 0.5) * LevelScale(nLevel) - 0.5;
00029 }
00030
00031
00032 inline Vector<2> LevelZeroPos(Vector<2> v2LevelPos, int nLevel)
00033 {
00034 Vector<2> v2Ans;
00035 v2Ans[0] = LevelZeroPos(v2LevelPos[0], nLevel);
00036 v2Ans[1] = LevelZeroPos(v2LevelPos[1], nLevel);
00037 return v2Ans;
00038 }
00039 inline Vector<2> LevelZeroPos(CVD::ImageRef irLevelPos, int nLevel)
00040 {
00041 Vector<2> v2Ans;
00042 v2Ans[0] = LevelZeroPos(irLevelPos.x, nLevel);
00043 v2Ans[1] = LevelZeroPos(irLevelPos.y, nLevel);
00044 return v2Ans;
00045 }
00046
00047
00048 inline double LevelNPos(double dRootPos, int nLevel)
00049 {
00050 return (dRootPos + 0.5) / LevelScale(nLevel) - 0.5;
00051 }
00052
00053
00054 inline Vector<2> LevelNPos(Vector<2> v2RootPos, int nLevel)
00055 {
00056 Vector<2> v2Ans;
00057 v2Ans[0] = LevelNPos(v2RootPos[0], nLevel);
00058 v2Ans[1] = LevelNPos(v2RootPos[1], nLevel);
00059 return v2Ans;
00060 }
00061
00062 #endif