OcTreeLUT.h
Go to the documentation of this file.
00001 /*
00002  * OctoMap - An Efficient Probabilistic 3D Mapping Framework Based on Octrees
00003  * http://octomap.github.com/
00004  *
00005  * Copyright (c) 2009-2013, K.M. Wurm and A. Hornung, University of Freiburg
00006  * All rights reserved.
00007  * License: New BSD
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions are met:
00011  *
00012  *     * Redistributions of source code must retain the above copyright
00013  *       notice, this list of conditions and the following disclaimer.
00014  *     * Redistributions in binary form must reproduce the above copyright
00015  *       notice, this list of conditions and the following disclaimer in the
00016  *       documentation and/or other materials provided with the distribution.
00017  *     * Neither the name of the University of Freiburg nor the names of its
00018  *       contributors may be used to endorse or promote products derived from
00019  *       this software without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00024  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00025  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00026  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00027  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00030  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00031  * POSSIBILITY OF SUCH DAMAGE.
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,                         // face neighbors
00076       SW, NW, SE, NE, TW, BW, TE, BE, TN, TS, BN, BS, // edge neighbors
00077       TNW, TSW, TNE, TSE, BNW, BSW, BNE, BSE          // vertex neighbors
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 } // namespace
00106 
00107 #endif


octomap
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Thu Aug 27 2015 14:13:14