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
00030
00031
00032
00033
00034 #ifndef OCTOMAP_OCTREE_LUT_H
00035 #define OCTOMAP_OCTREE_LUT_H
00036
00037
00038 #include "OcTreeLUTdefs.h"
00039 #include "octomap_types.h"
00040 #include "OcTreeKey.h"
00041
00042 namespace octomap {
00043
00044
00046 struct equal_keys {
00047 bool operator() (const unsigned short int* key1, const unsigned short int* key2) const {
00048 return ((key1[0]==key2[0]) && (key1[1] == key2[1]) && (key1[2] == key2[2]));
00049 }
00050 };
00051
00052 struct hash_key {
00053 unsigned short int operator()(const unsigned short int* key) const {
00054 return (((31 + key[0]) * 31 + key[1]) * 31 + key[2]);
00055 }
00056 };
00057
00058
00059
00064 class OcTreeLUT {
00065
00066 public:
00067
00074 typedef enum {
00075 W = 0, E, N, S , T , B,
00076 SW, NW, SE, NE, TW, BW, TE, BE, TN, TS, BN, BS,
00077 TNW, TSW, TNE, TSE, BNW, BSW, BNE, BSE
00078 } NeighborDirection;
00079
00080
00081 public:
00082
00083 OcTreeLUT(unsigned int _max_depth);
00084 ~OcTreeLUT();
00085
00086 bool genNeighborKey(const OcTreeKey& node_key, const signed char& dir,
00087 OcTreeKey& neighbor_key) const;
00088
00089 protected:
00090
00091 void initLUT();
00092
00093 unsigned int genPos(const OcTreeKey& key, const int& i) const;
00094 void changeKey(const int& val, OcTreeKey& key, const unsigned short int& i) const;
00095
00096 protected:
00097
00098 unsigned int max_depth;
00099
00100 signed char nf_values[8][26];
00101 signed char nf_rec_values[8][26];
00102 signed char nf_multiple_values[26][4];
00103 };
00104
00105 }
00106
00107 #endif