00001
00002 #include <stdio.h>
00003 #include <octomap/octomap.h>
00004 #include <octomap/OcTreeLUT.h>
00005
00006 using namespace std;
00007 using namespace octomap;
00008 using namespace octomath;
00009
00010
00011
00012 int main(int argc, char** argv) {
00013
00014 OcTreeLUT lut(16);
00015
00016
00017 OcTreeKey start_key (100, 100, 100);
00018 OcTreeKey neighbor_key;
00019
00020 cout << endl << "center key:" << endl;
00021 cout << "[" << start_key.k[0] << "," << start_key.k[1] << "," << start_key.k[2] << "]" << endl;
00022
00023 cout << endl << "face neighbor keys:" << endl;
00024
00025 lut.genNeighborKey(start_key, OcTreeLUT::N, neighbor_key);
00026 cout << "N -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00027
00028 lut.genNeighborKey(start_key, OcTreeLUT::S, neighbor_key);
00029 cout << "S -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00030
00031 lut.genNeighborKey(start_key, OcTreeLUT::W, neighbor_key);
00032 cout << "W -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00033
00034 lut.genNeighborKey(start_key, OcTreeLUT::E, neighbor_key);
00035 cout << "E -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00036
00037 lut.genNeighborKey(start_key, OcTreeLUT::T, neighbor_key);
00038 cout << "T -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00039
00040 lut.genNeighborKey(start_key, OcTreeLUT::B, neighbor_key);
00041 cout << "B -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00042
00043 cout << endl << "some edge neighbor keys:" << endl;
00044
00045 lut.genNeighborKey(start_key, OcTreeLUT::SE, neighbor_key);
00046 cout << "SE -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00047
00048 lut.genNeighborKey(start_key, OcTreeLUT::SW, neighbor_key);
00049 cout << "SW -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00050
00051 lut.genNeighborKey(start_key, OcTreeLUT::BS, neighbor_key);
00052 cout << "BS -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00053
00054 cout << endl << "some vertex neighbor keys:" << endl;
00055
00056 lut.genNeighborKey(start_key, OcTreeLUT::TNW, neighbor_key);
00057 cout << "TNW -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00058
00059 lut.genNeighborKey(start_key, OcTreeLUT::BNW, neighbor_key);
00060 cout << "BNW -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00061
00062 lut.genNeighborKey(start_key, OcTreeLUT::BSE, neighbor_key);
00063 cout << "BSE -> [" << neighbor_key.k[0] << "," << neighbor_key.k[1] << "," << neighbor_key.k[2] << "]" << endl;
00064
00065
00066 return 0;
00067 }