OcTreeLUT.h
Go to the documentation of this file.
1 /*
2  * OctoMap - An Efficient Probabilistic 3D Mapping Framework Based on Octrees
3  * http://octomap.github.com/
4  *
5  * Copyright (c) 2009-2013, K.M. Wurm and A. Hornung, University of Freiburg
6  * All rights reserved.
7  * License: New BSD
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * * Neither the name of the University of Freiburg nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef OCTOMAP_OCTREE_LUT_H
35 #define OCTOMAP_OCTREE_LUT_H
36 
37 
38 #include "OcTreeLUTdefs.h"
39 #include "octomap_types.h"
40 #include "OcTreeKey.h"
41 
42 namespace octomap {
43 
44 
46  struct equal_keys {
47  bool operator() (const unsigned short int* key1, const unsigned short int* key2) const {
48  return ((key1[0]==key2[0]) && (key1[1] == key2[1]) && (key1[2] == key2[2]));
49  }
50  };
51 
52  struct hash_key {
53  unsigned short int operator()(const unsigned short int* key) const {
54  return (((31 + key[0]) * 31 + key[1]) * 31 + key[2]);
55  }
56  };
57 
58 
59 
64  class OcTreeLUT {
65 
66  public:
67 
74  typedef enum {
75  W = 0, E, N, S , T , B, // face neighbors
76  SW, NW, SE, NE, TW, BW, TE, BE, TN, TS, BN, BS, // edge neighbors
77  TNW, TSW, TNE, TSE, BNW, BSW, BNE, BSE // vertex neighbors
79 
80 
81  public:
82 
83  OcTreeLUT(unsigned int _max_depth);
84  ~OcTreeLUT();
85 
86  bool genNeighborKey(const OcTreeKey& node_key, const signed char& dir,
87  OcTreeKey& neighbor_key) const;
88 
89  protected:
90 
91  void initLUT();
92 
93  unsigned int genPos(const OcTreeKey& key, const int& i) const;
94  void changeKey(const int& val, OcTreeKey& key, const unsigned short int& i) const;
95 
96  protected:
97 
98  unsigned int max_depth;
99 
100  signed char nf_values[8][26];
101  signed char nf_rec_values[8][26];
102  signed char nf_multiple_values[26][4];
103  };
104 
105 } // namespace
106 
107 #endif
bool operator()(const unsigned short int *key1, const unsigned short int *key2) const
Definition: OcTreeLUT.h:47
unsigned short int operator()(const unsigned short int *key) const
Definition: OcTreeLUT.h:53
unsigned int max_depth
Definition: OcTreeLUT.h:98
comparator for keys
Definition: OcTreeLUT.h:46


octomap
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Mon Jun 10 2019 14:00:13