Go to the documentation of this file.
34 #ifndef OCTOMAP_OCTREE_KEY_H
35 #define OCTOMAP_OCTREE_KEY_H
47 #if defined(__GNUC__) && ! defined(_LIBCPP_VERSION)
48 #include <tr1/unordered_set>
49 #include <tr1/unordered_map>
51 namespace unordered_ns = std::tr1;
54 #include <unordered_set>
55 #include <unordered_map>
57 namespace unordered_ns = std;
87 return ((
k[0] == other[0]) && (
k[1] == other[1]) && (
k[2] == other[2]));
91 return( (
k[0] != other[0]) || (
k[1] != other[1]) || (
k[2] != other[2]) );
95 k[0] = other.
k[0];
k[1] = other.
k[1];
k[2] = other.
k[2];
115 return static_cast<size_t>(key.
k[0])
116 + 1447*
static_cast<size_t>(key.
k[1])
117 + 345637*
static_cast<size_t>(key.
k[2]);
129 typedef unordered_ns::unordered_set<OcTreeKey, OcTreeKey::KeyHash>
KeySet;
136 typedef unordered_ns::unordered_map<OcTreeKey, bool, OcTreeKey::KeyHash>
KeyBoolMap;
149 size_t dSize = other.
end() - other.
begin();
150 end_of_ray = ray.begin() + dSize;
154 end_of_ray =
begin();
158 assert(end_of_ray != ray.end());
163 size_t size()
const {
return end_of_ray - ray.begin(); }
179 std::vector<OcTreeKey> ray;
180 std::vector<OcTreeKey>::iterator end_of_ray;
181 const static size_t maxSize = 100000;
196 if (pos & 1) child_key[0] = parent_key[0] + center_offset_key;
197 else child_key[0] = parent_key[0] - center_offset_key - (center_offset_key ? 0 : 1);
199 if (pos & 2) child_key[1] = parent_key[1] + center_offset_key;
200 else child_key[1] = parent_key[1] - center_offset_key - (center_offset_key ? 0 : 1);
202 if (pos & 4) child_key[2] = parent_key[2] + center_offset_key;
203 else child_key[2] = parent_key[2] - center_offset_key - (center_offset_key ? 0 : 1);
209 if (key.
k[0] & (1 << depth))
212 if (key.
k[1] & (1 << depth))
215 if (key.
k[2] & (1 << depth))
uint16_t key_type
Definition: OcTreeKey.h:63
std::vector< OcTreeKey >::const_iterator const_iterator
Definition: OcTreeKey.h:167
std::vector< OcTreeKey >::iterator iterator
Definition: OcTreeKey.h:166
std::vector< OcTreeKey >::reverse_iterator reverse_iterator
Definition: OcTreeKey.h:168
bool operator!=(const OcTreeKey &other) const
Definition: OcTreeKey.h:90
const_iterator end() const
Definition: OcTreeKey.h:173
OcTreeKey()
Definition: OcTreeKey.h:73
const key_type & operator[](unsigned int i) const
Definition: OcTreeKey.h:99
OcTreeKey & operator=(const OcTreeKey &other)
Definition: OcTreeKey.h:94
Definition: OcTreeKey.h:139
unordered_ns::unordered_map< OcTreeKey, bool, OcTreeKey::KeyHash > KeyBoolMap
Data structrure to efficiently track changed nodes as a combination of OcTreeKeys and a bool flag (to...
Definition: OcTreeKey.h:136
const_iterator begin() const
Definition: OcTreeKey.h:172
void reset()
Definition: OcTreeKey.h:153
unordered_ns::unordered_set< OcTreeKey, OcTreeKey::KeyHash > KeySet
Data structure to efficiently compute the nodes to update from a scan insertion using a hash set.
Definition: OcTreeKey.h:129
size_t sizeMax() const
Definition: OcTreeKey.h:164
key_type k[3]
Definition: OcTreeKey.h:107
KeyRay()
Definition: OcTreeKey.h:142
size_t operator()(const OcTreeKey &key) const
Definition: OcTreeKey.h:111
iterator end()
Definition: OcTreeKey.h:171
OcTreeKey is a container class for internal key addressing.
Definition: OcTreeKey.h:70
reverse_iterator rbegin()
Definition: OcTreeKey.h:175
Provides a hash function on Keys.
Definition: OcTreeKey.h:110
uint8_t computeChildIdx(const OcTreeKey &key, int depth)
generate child index (between 0 and 7) from key at given tree depth
Definition: OcTreeKey.h:207
bool operator==(const OcTreeKey &other) const
Definition: OcTreeKey.h:86
reverse_iterator rend()
Definition: OcTreeKey.h:176
Tables used by the Marching Cubes Algorithm The tables are from Paul Bourke's web page http://paulbou...
iterator begin()
Definition: OcTreeKey.h:170
void computeChildKey(unsigned int pos, key_type center_offset_key, const OcTreeKey &parent_key, OcTreeKey &child_key)
Computes the key of a child node while traversing the octree, given child index and current key.
Definition: OcTreeKey.h:193
OcTreeKey computeIndexKey(key_type level, const OcTreeKey &key)
Generates a unique key for all keys on a certain level of the tree.
Definition: OcTreeKey.h:228
OcTreeKey(key_type a, key_type b, key_type c)
Definition: OcTreeKey.h:74
KeyRay(const KeyRay &other)
Definition: OcTreeKey.h:147
void addKey(const OcTreeKey &k)
Definition: OcTreeKey.h:157
size_t size() const
Definition: OcTreeKey.h:163
OcTreeKey(const OcTreeKey &other)
Definition: OcTreeKey.h:80