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
00035
00036
00037
00038 #ifndef OCTREE_KEY_H
00039 #define OCTREE_KEY_H
00040
00041 namespace pcl
00042 {
00043 namespace octree
00044 {
00046
00050
00051 class OctreeKey
00052 {
00053 public:
00054
00056 OctreeKey () :
00057 x (0), y (0), z (0)
00058 {
00059 }
00060
00062 OctreeKey (unsigned int keyX, unsigned int keyY, unsigned int keyZ) :
00063 x (keyX), y (keyY), z (keyZ)
00064 {
00065 }
00066
00068 OctreeKey (const OctreeKey& source) :
00069 x (source.x), y (source.y), z (source.z)
00070 {
00071 }
00072
00076 bool
00077 operator == (const OctreeKey& b) const
00078 {
00079 return ((b.x == this->x) && (b.y == this->y) && (b.z == this->z));
00080 }
00081
00085 bool
00086 operator <= (const OctreeKey& b) const
00087 {
00088 return ((b.x >= this->x) && (b.y >= this->y) && (b.z >= this->z));
00089 }
00090
00094 bool
00095 operator >= (const OctreeKey& b) const
00096 {
00097 return ((b.x <= this->x) && (b.y <= this->y) && (b.z <= this->z));
00098 }
00099
00103 inline void
00104 pushBranch (unsigned char childIndex)
00105 {
00106 this->x = (this->x << 1) | (!!(childIndex & (1 << 2)));
00107 this->y = (this->y << 1) | (!!(childIndex & (1 << 1)));
00108 this->z = (this->z << 1) | (!!(childIndex & (1 << 0)));
00109 }
00110
00113 inline void
00114 popBranch ()
00115 {
00116 this->x >>= 1;
00117 this->y >>= 1;
00118 this->z >>= 1;
00119 }
00120
00125 inline unsigned char
00126 getChildIdxWithDepthMask (unsigned int depthMask) const
00127 {
00128 return static_cast<unsigned char> (((!!(this->x & depthMask)) << 2)
00129 | ((!!(this->y & depthMask)) << 1)
00130 | (!!(this->z & depthMask)));
00131 }
00132
00133
00134 unsigned int x;
00135 unsigned int y;
00136 unsigned int z;
00137
00138 };
00139 }
00140 }
00141
00142 #endif