GraphPyramidLookupTable.cpp
Go to the documentation of this file.
1
// *****************************************************************
2
// Filename: GraphLookupTable.cpp
3
// Copyright: Kai Welke, Chair Prof. Dillmann (IAIM),
4
// Institute for Computer Science and Engineering (CSE),
5
// University of Karlsruhe. All rights reserved.
6
// Author: Kai Welke
7
// Date: 10.10.2008
8
// *****************************************************************
9
10
// *****************************************************************
11
// includes
12
// *****************************************************************
13
#include "
GraphPyramidLookupTable.h
"
14
15
#include <cstdlib>
16
17
#include "
MathTools.h
"
18
19
// *****************************************************************
20
// implementation of CGraphLookupTable
21
// *****************************************************************
22
// construction / destruction
23
CGraphPyramidLookupTable::CGraphPyramidLookupTable
(
int
nMaxZenithBins,
int
nMaxAzimuthBins)
24
{
25
m_nMaxZenithBins = nMaxZenithBins;
26
m_nMaxAzimuthBins = nMaxAzimuthBins;
27
28
m_nSubDivision = 2;
29
m_nLevels = 0;
30
31
CGraphLookupTable
* pTable;
32
33
while
(nMaxZenithBins != 0)
34
{
35
pTable =
new
CGraphLookupTable
(nMaxZenithBins, nMaxAzimuthBins);
36
37
m_Tables.push_back(pTable);
38
39
// printf("Level %d: zenithbins: %d, azimuithbins: %d\n", m_nLevels, nMaxZenithBins, nMaxAzimuthBins);
40
41
m_nLevels++;
42
nMaxZenithBins /= m_nSubDivision;
43
nMaxAzimuthBins /= m_nSubDivision;
44
}
45
}
46
47
CGraphPyramidLookupTable::~CGraphPyramidLookupTable
()
48
{
49
std::list<CGraphLookupTable*>::iterator iter = m_Tables.begin();
50
51
while
(iter != m_Tables.end())
52
{
53
delete
*iter;
54
55
iter++;
56
}
57
}
58
59
void
60
CGraphPyramidLookupTable::buildLookupTable
(
CSphericalGraph
* pGraph)
61
{
62
std::list<CGraphLookupTable*>::iterator iter = m_Tables.begin();
63
64
while
(iter != m_Tables.end())
65
{
66
(*iter)->buildLookupTable(pGraph);
67
68
iter++;
69
}
70
}
71
72
int
73
CGraphPyramidLookupTable::getClosestNode
(Eigen::Vector3d position)
74
{
75
TSphereCoord
coords;
76
MathTools::convert
(position, coords);
77
78
return
getClosestNode
(coords);
79
}
80
81
int
82
CGraphPyramidLookupTable::getClosestNode
(
TSphereCoord
position)
83
{
84
bool
bFinished =
false
;
85
std::list<CGraphLookupTable*>::iterator iter = m_Tables.begin();
86
int
nIndex = -1;
87
88
int
L = 0;
89
90
while
(iter != m_Tables.end())
91
{
92
nIndex = (*iter)->getClosestNode(position, bFinished);
93
// printf("Result in level %d: index %d, finished: %d\n",L,nIndex,bFinished);
94
95
if
(bFinished)
96
{
97
break
;
98
}
99
100
L++;
101
iter++;
102
}
103
104
if
(!bFinished)
105
{
106
printf(
"CGraphPyramidLookupTable:: no closest node found\n"
);
107
exit(1);
108
}
109
110
return
nIndex;
111
}
GraphPyramidLookupTable.h
MathTools.h
CGraphLookupTable
Definition
GraphLookupTable.h:23
CGraphPyramidLookupTable::~CGraphPyramidLookupTable
~CGraphPyramidLookupTable()
Definition
GraphPyramidLookupTable.cpp:47
CGraphPyramidLookupTable::getClosestNode
int getClosestNode(Eigen::Vector3d position)
Definition
GraphPyramidLookupTable.cpp:73
CGraphPyramidLookupTable::CGraphPyramidLookupTable
CGraphPyramidLookupTable(int nMaxZenithBins, int nMaxAzimuthBins)
Definition
GraphPyramidLookupTable.cpp:23
CGraphPyramidLookupTable::buildLookupTable
void buildLookupTable(CSphericalGraph *pGraph)
Definition
GraphPyramidLookupTable.cpp:60
CSphericalGraph
Definition
SphericalGraph.h:106
MathTools::convert
static void convert(TSphereCoord in, Eigen::Vector3d &out)
Definition
MathTools.cpp:440
TSphereCoord
Definition
Structs.h:24
RobotAPI
components
EarlyVisionGraph
GraphPyramidLookupTable.cpp
Generated by
1.13.2