|
Point Cloud Library (PCL)
1.5.1
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2010-2011, Willow Garage, Inc. 00006 * 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * * Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * * Redistributions in binary form must reproduce the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer in the documentation and/or other materials provided 00018 * with the distribution. 00019 * * Neither the name of Willow Garage, Inc. nor the names of its 00020 * contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00026 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00027 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00028 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00029 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00032 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00033 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 * $Id: octree2buf_base.h 4702 2012-02-23 09:39:33Z gedikli $ 00037 */ 00038 00039 #ifndef OCTREE_TREE_2BUF_BASE_H 00040 #define OCTREE_TREE_2BUF_BASE_H 00041 00042 #include <vector> 00043 00044 #include "octree_nodes.h" 00045 00046 #include "octree_iterator.h" 00047 00048 namespace pcl 00049 { 00050 namespace octree 00051 { 00065 template<typename DataT, typename LeafT = OctreeLeafDataT<DataT> > 00066 class Octree2BufBase 00067 { 00068 00069 // iterators are friends 00070 friend class OctreeIteratorBase<DataT, LeafT, Octree2BufBase> ; 00071 friend class OctreeDepthFirstIterator<DataT, LeafT, Octree2BufBase> ; 00072 friend class OctreeBreadthFirstIterator<DataT, LeafT, Octree2BufBase> ; 00073 friend class OctreeLeafNodeIterator<DataT, LeafT, Octree2BufBase> ; 00074 00075 public: 00076 00077 // Octree iterators 00078 typedef OctreeDepthFirstIterator<DataT, LeafT, Octree2BufBase> Iterator; 00079 typedef const OctreeDepthFirstIterator<DataT, LeafT, Octree2BufBase> ConstIterator; 00080 00081 typedef OctreeLeafNodeIterator<DataT, LeafT, Octree2BufBase> LeafNodeIterator; 00082 typedef const OctreeLeafNodeIterator<DataT, LeafT, Octree2BufBase> ConstLeafNodeIterator; 00083 00084 typedef OctreeDepthFirstIterator<DataT, LeafT, Octree2BufBase> DepthFirstIterator; 00085 typedef const OctreeDepthFirstIterator<DataT, LeafT, Octree2BufBase> ConstDepthFirstIterator; 00086 typedef OctreeBreadthFirstIterator<DataT, LeafT, Octree2BufBase> BreadthFirstIterator; 00087 typedef const OctreeBreadthFirstIterator<DataT, LeafT, Octree2BufBase> ConstBreadthFirstIterator; 00088 00090 Octree2BufBase (); 00091 00093 virtual 00094 ~Octree2BufBase (); 00095 00097 Octree2BufBase (const Octree2BufBase& source) 00098 { 00099 leafCount_ = source.leafCount_; 00100 branchCount_ = source.branchCount_; 00101 objectCount_ = source.objectCount_; 00102 rootNode_ = new (OctreeBranch) (*(source.rootNode_)); 00103 depthMask_ = source.depthMask_; 00104 octreeDepth_ = source.octreeDepth_; 00105 bufferSelector_ = source.bufferSelector_; 00106 resetTree_ = source.resetTree_; 00107 treeDirtyFlag_ = source.treeDirtyFlag_; 00108 } 00109 00113 void 00114 setMaxVoxelIndex (unsigned int maxVoxelIndex_arg); 00115 00119 void 00120 setTreeDepth (unsigned int depth_arg); 00121 00125 inline unsigned int 00126 getTreeDepth () const 00127 { 00128 return this->octreeDepth_; 00129 } 00130 00137 void 00138 add (const unsigned int idxX_arg, const unsigned int idxY_arg, const unsigned int idxZ_arg, 00139 const DataT& data_arg); 00140 00148 bool 00149 get (const unsigned int idxX_arg, const unsigned int idxY_arg, const unsigned int idxZ_arg, DataT& data_arg) const ; 00150 00157 bool 00158 existLeaf (const unsigned int idxX_arg, const unsigned int idxY_arg, const unsigned int idxZ_arg) const ; 00159 00165 void 00166 removeLeaf (const unsigned int idxX_arg, const unsigned int idxY_arg, const unsigned int idxZ_arg); 00167 00171 inline unsigned int 00172 getLeafCount () const 00173 { 00174 return leafCount_; 00175 } 00176 00180 inline unsigned int 00181 getBranchCount () const 00182 { 00183 return branchCount_; 00184 } 00185 00189 void 00190 deleteTree ( bool freeMemory_arg = false ); 00191 00193 inline void 00194 deletePreviousBuffer () 00195 { 00196 treeCleanUpRecursive (rootNode_); 00197 } 00198 00200 inline void 00201 deleteCurrentBuffer () 00202 { 00203 bufferSelector_ = !bufferSelector_; 00204 treeCleanUpRecursive (rootNode_); 00205 leafCount_ = 0; 00206 } 00207 00209 void 00210 switchBuffers (); 00211 00216 void 00217 serializeTree (std::vector<char>& binaryTreeOut_arg, bool doXOREncoding_arg = false); 00218 00224 void 00225 serializeTree (std::vector<char>& binaryTreeOut_arg, std::vector<DataT>& dataVector_arg, 00226 bool doXOREncoding_arg = false); 00227 00231 void 00232 serializeLeafs (std::vector<DataT>& dataVector_arg); 00233 00238 void 00239 serializeNewLeafs (std::vector<DataT>& dataVector_arg, const int minPointsPerLeaf_arg = 0); 00240 00245 void 00246 deserializeTree (std::vector<char>& binaryTreeIn_arg, bool doXORDecoding_arg = false); 00247 00253 void 00254 deserializeTree (std::vector<char>& binaryTreeIn_arg, std::vector<DataT>& dataVector_arg, 00255 bool doXORDecoding_arg = false); 00256 00262 void 00263 deserializeTreeAndOutputLeafData (std::vector<char>& binaryTreeIn_arg, std::vector<DataT>& dataVector_arg, 00264 bool doXORDecoding_arg = false); 00265 00266 protected: 00267 00269 00273 00274 class OctreeKey 00275 { 00276 public: 00277 00281 bool 00282 operator == (const OctreeKey& b) const 00283 { 00284 return ((b.x == this->x) && (b.y == this->y) && (b.z == this->z)); 00285 } 00286 00287 // Indices addressing a voxel at (X, Y, Z) 00288 unsigned int x;unsigned int y;unsigned int z; 00289 }; 00290 00292 00296 00297 class OctreeBranch : public OctreeNode 00298 { 00299 00300 // Octree2BufBase is a friend! 00301 friend class Octree2BufBase; 00302 00303 public: 00304 00306 OctreeBranch () 00307 { 00308 memset (this->subNodes_, 0, sizeof(this->subNodes_)); 00309 } 00310 00312 virtual 00313 ~OctreeBranch () 00314 { 00315 } 00316 00318 inline 00319 virtual OctreeNode * 00320 deepCopy () const 00321 { 00322 return (OctreeNode*) new OctreeBranch (*this); 00323 } 00324 00328 inline 00329 virtual node_type_t 00330 getNodeType () const 00331 { 00332 return BRANCH_NODE; 00333 } 00334 00335 private: 00336 00338 const OctreeNode * subNodes_[2][8]; 00339 }; 00340 00341 typedef LeafT OctreeLeaf; 00342 00344 // Protected octree methods based on octree keys 00346 00348 const OctreeNode* 00349 getRootNode () const 00350 { 00351 return this->rootNode_; 00352 } 00353 00359 virtual bool 00360 genOctreeKeyForDataT (const DataT& data_arg, OctreeKey & key_arg) const 00361 { 00362 // this class cannot relate DataT objects to octree keys 00363 return false; 00364 } 00365 00371 virtual bool 00372 genDataTByOctreeKey (const OctreeKey & key_arg, DataT& data_arg) const 00373 { 00374 // this class cannot relate DataT objects to octree keys 00375 return false; 00376 } 00377 00384 inline void 00385 genOctreeKeyByIntIdx (const unsigned int idxX_arg, const unsigned int idxY_arg, const unsigned int idxZ_arg, 00386 OctreeKey & key_arg) const 00387 { 00388 // copy data to octree key class 00389 key_arg.x = idxX_arg; 00390 key_arg.y = idxY_arg; 00391 key_arg.z = idxZ_arg; 00392 } 00393 00398 inline void 00399 add (const OctreeKey& key_arg, const DataT& data_arg) 00400 { 00401 // request a (new) leaf from tree 00402 LeafT* leaf = getLeaf (key_arg); 00403 00404 // assign data to leaf 00405 if (leaf) 00406 { 00407 leaf->setData (data_arg); 00408 objectCount_++; 00409 } 00410 } 00411 00416 inline LeafT* 00417 findLeaf (const OctreeKey& key_arg) const 00418 { 00419 return findLeafRecursive (key_arg, depthMask_, rootNode_); 00420 } 00421 00427 inline LeafT* 00428 getLeaf (const OctreeKey& key_arg) 00429 { 00430 LeafT* result; 00431 00432 result = getLeafRecursive (key_arg, depthMask_, rootNode_, resetTree_); 00433 00434 // getLeafRecursive has changed the octree -> clean-up/tree-reset might be required 00435 resetTree_ = false; 00436 treeDirtyFlag_ = true; 00437 00438 return result; 00439 } 00440 00445 inline bool 00446 existLeaf (const OctreeKey& key_arg) const 00447 { 00448 return (findLeafRecursive (key_arg, depthMask_, rootNode_) != 0); 00449 } 00450 00454 inline void 00455 removeLeaf (const OctreeKey& key_arg) 00456 { 00457 deleteLeafRecursive (key_arg, depthMask_, rootNode_); 00458 00459 // we changed the octree structure -> dirty 00460 treeDirtyFlag_ = true; 00461 } 00462 00464 // Branch node accessor inline functions 00466 00467 00473 inline const OctreeNode* 00474 getBranchChild (const OctreeBranch& branch_arg, const unsigned char childIdx_arg) const 00475 { 00476 return branch_arg.subNodes_[bufferSelector_][childIdx_arg]; 00477 } 00478 00485 inline const OctreeNode* 00486 getBranchChild (const OctreeBranch& branch_arg, const unsigned char bufferSelector_arg, 00487 const unsigned char childIdx_arg) const 00488 { 00489 return branch_arg.subNodes_[bufferSelector_arg][childIdx_arg]; 00490 } 00491 00497 inline bool 00498 branchHasChild (const OctreeBranch& branch_arg, const unsigned char childIdx_arg) const 00499 { 00500 return (branch_arg.subNodes_[bufferSelector_][childIdx_arg] != 0); 00501 } 00502 00509 inline bool 00510 branchHasChild (const OctreeBranch& branch_arg, const unsigned char bufferSelector_arg, 00511 const unsigned char childIdx_arg) const 00512 { 00513 return (branch_arg.subNodes_[bufferSelector_arg][childIdx_arg] != 0); 00514 00515 } 00516 00521 inline char 00522 getBranchBitPattern (const OctreeBranch& branch_arg) const 00523 { 00524 unsigned char i; 00525 char nodeBits; 00526 00527 // create bit pattern 00528 nodeBits = 0; 00529 for (i = 0; i < 8; i++) 00530 { 00531 nodeBits |= (!!branch_arg.subNodes_[bufferSelector_][i]) << i; 00532 } 00533 00534 return nodeBits; 00535 } 00536 00542 inline char 00543 getBranchBitPattern (const OctreeBranch& branch_arg, const unsigned char bufferSelector_arg) const 00544 { 00545 unsigned char i; 00546 char nodeBits; 00547 00548 // create bit pattern 00549 nodeBits = 0; 00550 for (i = 0; i < 8; i++) 00551 { 00552 nodeBits |= (!!branch_arg.subNodes_[bufferSelector_arg][i]) << i; 00553 } 00554 00555 return nodeBits; 00556 } 00557 00562 inline char 00563 getBranchXORBitPattern (const OctreeBranch& branch_arg) const 00564 { 00565 unsigned char i; 00566 char nodeBits[2]; 00567 00568 // create bit pattern for both buffers 00569 nodeBits[0] = nodeBits[1] = 0; 00570 00571 for (i = 0; i < 8; i++) 00572 { 00573 nodeBits[0] |= (!!branch_arg.subNodes_[0][i]) << i; 00574 nodeBits[1] |= (!!branch_arg.subNodes_[1][i]) << i; 00575 } 00576 00577 return nodeBits[0] ^ nodeBits[1]; 00578 } 00579 00584 inline bool 00585 hasBranchChanges (const OctreeBranch& branch_arg) const 00586 { 00587 return (getBranchXORBitPattern (branch_arg) > 0); 00588 } 00589 00595 inline void 00596 setBranchChild (OctreeBranch& branch_arg, const unsigned char childIdx_arg, const OctreeNode * newChild_arg) 00597 { 00598 branch_arg.subNodes_[bufferSelector_][childIdx_arg] = newChild_arg; 00599 } 00600 00607 inline void 00608 setBranchChild (OctreeBranch& branch_arg, const unsigned char bufferSelector_arg, 00609 const unsigned char childIdx_arg, const OctreeNode * newChild_arg) 00610 { 00611 branch_arg.subNodes_[bufferSelector_arg][childIdx_arg] = newChild_arg; 00612 } 00613 00618 inline void 00619 deleteBranchChild (OctreeBranch& branch_arg, const unsigned char childIdx_arg) 00620 { 00621 if (branchHasChild (branch_arg, childIdx_arg)) 00622 { 00623 const OctreeNode* branchChild; 00624 branchChild = getBranchChild (branch_arg, childIdx_arg); 00625 00626 switch (branchChild->getNodeType ()) 00627 { 00628 case BRANCH_NODE: 00629 { 00630 // free child branch recursively 00631 deleteBranch (*(OctreeBranch*)branchChild); 00632 00633 // push unused branch to branch pool 00634 unusedBranchesPool_.push_back ((OctreeBranch*)branchChild); 00635 } 00636 break; 00637 00638 case LEAF_NODE: 00639 // push unused leaf to branch pool 00640 unusedLeafsPool_.push_back ((OctreeLeaf*)branchChild); 00641 break; 00642 00643 default: 00644 break; 00645 } 00646 00647 // set branch child pointer to 0 00648 setBranchChild (branch_arg, childIdx_arg, 0); 00649 } 00650 } 00651 00657 inline void 00658 deleteBranchChild (OctreeBranch& branch_arg, const unsigned char bufferSelector_arg, 00659 const unsigned char childIdx_arg) 00660 { 00661 if (branchHasChild (branch_arg, bufferSelector_arg, childIdx_arg)) 00662 { 00663 const OctreeNode* branchChild; 00664 branchChild = getBranchChild (branch_arg, bufferSelector_arg, childIdx_arg); 00665 00666 switch (branchChild->getNodeType ()) 00667 { 00668 case BRANCH_NODE: 00669 { 00670 // free child branch recursively 00671 deleteBranch (*(OctreeBranch*)branchChild); 00672 00673 // push unused branch to branch pool 00674 unusedBranchesPool_.push_back ((OctreeBranch*)branchChild); 00675 } 00676 break; 00677 00678 case LEAF_NODE: 00679 // push unused leaf to branch pool 00680 unusedLeafsPool_.push_back ((OctreeLeaf*)branchChild); 00681 break; 00682 00683 default: 00684 break; 00685 } 00686 00687 // set branch child pointer to 0 00688 setBranchChild (branch_arg, bufferSelector_arg, childIdx_arg, 0); 00689 00690 } 00691 } 00692 00696 inline void 00697 deleteBranch (OctreeBranch& branch_arg) 00698 { 00699 char i; 00700 00701 // delete all branch node children 00702 for (i = 0; i < 8; i++) 00703 { 00704 00705 if (getBranchChild (branch_arg, 0, i) == getBranchChild (branch_arg, 1, i)) 00706 { 00707 // reference was copied - there is only one child instance to be deleted 00708 deleteBranchChild (branch_arg, 0, i); 00709 00710 // remove pointers from both buffers 00711 setBranchChild (branch_arg, 0, i, 0); 00712 setBranchChild (branch_arg, 1, i, 0); 00713 00714 } 00715 else 00716 { 00717 deleteBranchChild (branch_arg, 0, i); 00718 deleteBranchChild (branch_arg, 1, i); 00719 } 00720 } 00721 } 00722 00728 inline void 00729 createBranchChild (OctreeBranch& branch_arg, const unsigned char childIdx_arg, 00730 OctreeBranch*& newBranchChild_arg) 00731 { 00732 if (!unusedBranchesPool_.size ()) 00733 { 00734 newBranchChild_arg = (OctreeBranch*)new OctreeBranch (); 00735 } 00736 else 00737 { 00738 newBranchChild_arg = unusedBranchesPool_.back (); 00739 unusedBranchesPool_.pop_back (); 00740 branchReset (*newBranchChild_arg); 00741 } 00742 00743 setBranchChild (branch_arg, childIdx_arg, (OctreeNode*)newBranchChild_arg); 00744 } 00745 00749 inline void 00750 createBranch (OctreeBranch*& newBranchChild_arg) 00751 { 00752 00753 if (!unusedBranchesPool_.size ()) 00754 { 00755 // branch pool is empty 00756 // we need to create a new octree branch class 00757 newBranchChild_arg = (OctreeBranch*)new OctreeBranch (); 00758 } 00759 else 00760 { 00761 // reuse branch from branch pool 00762 newBranchChild_arg = unusedBranchesPool_.back (); 00763 unusedBranchesPool_.pop_back (); 00764 branchReset (*newBranchChild_arg); 00765 } 00766 } 00767 00773 inline void 00774 createLeafChild (OctreeBranch& branch_arg, const unsigned char childIdx_arg, OctreeLeaf*& newLeafChild_arg) 00775 { 00776 if (!unusedLeafsPool_.size ()) 00777 { 00778 // leaf pool is empty 00779 // we need to create a new octree leaf class 00780 newLeafChild_arg = (OctreeLeaf*)new OctreeLeaf (); 00781 } 00782 else 00783 { 00784 // reuse leaf node from branch pool 00785 newLeafChild_arg = unusedLeafsPool_.back (); 00786 unusedLeafsPool_.pop_back (); 00787 } 00788 00789 newLeafChild_arg->reset (); 00790 00791 setBranchChild (branch_arg, childIdx_arg, (OctreeNode*)newLeafChild_arg); 00792 } 00793 00797 inline void 00798 branchReset (OctreeBranch& branch_arg) 00799 { 00800 memset (branch_arg.subNodes_, 0, sizeof(branch_arg.subNodes_)); 00801 } 00802 00805 inline void 00806 poolCleanUp () 00807 { 00808 // delete all branch instances from branch pool 00809 while (!unusedBranchesPool_.empty ()) 00810 { 00811 delete (unusedBranchesPool_.back ()); 00812 unusedBranchesPool_.pop_back (); 00813 } 00814 00815 // delete all leaf instances from leaf pool 00816 while (!unusedLeafsPool_.empty ()) 00817 { 00818 delete (unusedLeafsPool_.back ()); 00819 unusedLeafsPool_.pop_back (); 00820 } 00821 } 00822 00824 // Recursive octree methods 00826 00827 00835 LeafT* 00836 getLeafRecursive (const OctreeKey& key_arg, const unsigned int depthMask_arg, OctreeBranch* branch_arg, 00837 bool branchReset_arg); 00838 00846 LeafT* 00847 findLeafRecursive (const OctreeKey& key_arg, const unsigned int depthMask_arg, OctreeBranch* branch_arg) const; 00848 00855 bool 00856 deleteLeafRecursive (const OctreeKey& key_arg, const unsigned int depthMask_arg, OctreeBranch* branch_arg); 00857 00864 void 00865 serializeTreeRecursive (std::vector<char>& binaryTreeOut_arg, OctreeBranch* branch_arg, const OctreeKey& key_arg, 00866 bool doXOREncoding_arg); 00867 00875 void 00876 serializeTreeRecursive (std::vector<char>& binaryTreeOut_arg, OctreeBranch* branch_arg, const OctreeKey& key_arg, 00877 typename std::vector<DataT>& dataVector_arg, bool doXOREncoding_arg); 00878 00884 void 00885 serializeLeafsRecursive (OctreeBranch* branch_arg, const OctreeKey& key_arg, 00886 typename std::vector<DataT>& dataVector_arg); 00887 00894 void 00895 serializeNewLeafsRecursive (OctreeBranch* branch_arg, const OctreeKey& key_arg, 00896 std::vector<DataT>& dataVector_arg, const int minPointsPerLeaf_arg = 0); 00897 00906 void 00907 deserializeTreeRecursive (typename std::vector<char>::const_iterator& binaryTreeIn_arg, 00908 OctreeBranch* branch_arg, const unsigned int depthMask_arg, const OctreeKey& key_arg, 00909 bool branchReset_arg, bool doXORDecoding_arg); 00910 00921 void 00922 deserializeTreeRecursive (typename std::vector<char>::const_iterator& binaryTreeIn_arg, 00923 OctreeBranch* branch_arg, const unsigned int depthMask_arg, const OctreeKey& key_arg, 00924 typename std::vector<DataT>::const_iterator& dataVectorIterator_arg, 00925 typename std::vector<DataT>::const_iterator& dataVectorEndIterator_arg, 00926 bool branchReset_arg, bool doXORDecoding_arg); 00927 00937 void 00938 deserializeTreeAndOutputLeafDataRecursive (typename std::vector<char>::const_iterator& binaryTreeIn_arg, 00939 OctreeBranch* branch_arg, const unsigned int depthMask_arg, 00940 const OctreeKey& key_arg, 00941 typename std::vector<DataT>& dataVector_arg, 00942 bool branchReset_arg, bool doXORDecoding_arg); 00943 00945 // Serialization callbacks 00947 00952 virtual void 00953 serializeLeafCallback (OctreeLeaf& leaf_arg, const OctreeKey& key_arg); 00954 00960 virtual void 00961 serializeLeafCallback (OctreeLeaf& leaf_arg, const OctreeKey& key_arg, std::vector<DataT>& dataVector_arg); 00962 00969 virtual void 00970 serializeNewLeafCallback (OctreeLeaf& leaf_arg, const OctreeKey& key_arg, const int minPointsPerLeaf_arg, 00971 std::vector<DataT>& dataVector_arg); 00972 00977 virtual void 00978 deserializeLeafCallback (OctreeLeaf& leaf_arg, const OctreeKey& key_arg); 00979 00986 virtual void 00987 deserializeLeafCallback (OctreeLeaf& leaf_arg, const OctreeKey& key_arg, 00988 typename std::vector<DataT>::const_iterator& dataVectorIterator_arg, 00989 typename std::vector<DataT>::const_iterator& dataVectorEndIterator_arg); 00990 00996 virtual void 00997 deserializeTreeAndSerializeLeafCallback (OctreeLeaf& leaf_arg, const OctreeKey & key_arg, 00998 std::vector<DataT>& dataVector_arg); 00999 01001 // Helpers 01003 01007 void 01008 treeCleanUpRecursive (OctreeBranch* branch_arg); 01009 01014 inline double 01015 Log2 (double n_arg) 01016 { 01017 return log (n_arg) / log (2.0); 01018 } 01019 01023 inline bool 01024 octreeCanResize () 01025 { 01026 return (false); 01027 } 01028 01030 // Globals 01032 01033 01035 unsigned int leafCount_; 01036 01038 unsigned int branchCount_; 01039 01041 unsigned int objectCount_; 01042 01044 OctreeBranch* rootNode_; 01045 01047 unsigned int depthMask_; 01048 01050 std::vector<OctreeBranch*> unusedBranchesPool_; 01051 01053 std::vector<LeafT*> unusedLeafsPool_; 01054 01056 unsigned char bufferSelector_; 01057 01058 // flags indicating if unused branches and leafs might exist in previous buffer 01059 bool resetTree_; 01060 bool treeDirtyFlag_; 01061 01063 unsigned int octreeDepth_; 01064 01065 }; 01066 } 01067 } 01068 01069 //#include "impl/octree2buf_base.hpp" 01070 01071 #endif 01072
1.8.0