39 #ifndef PCL_OCTREE_TREE_2BUF_BASE_H
40 #define PCL_OCTREE_TREE_2BUF_BASE_H
44 #include "octree_nodes.h"
45 #include "octree_container.h"
46 #include "octree_key.h"
47 #include "octree_iterator.h"
57 template<
typename ContainerT>
83 for (b = 0; b < 2; ++b)
84 for (i = 0; i < 8; ++i)
110 getChildPtr (
unsigned char buffer_arg,
unsigned char index_arg)
const
112 assert( (buffer_arg<2) && (index_arg<8));
121 inline void setChildPtr (
unsigned char buffer_arg,
unsigned char index_arg,
124 assert( (buffer_arg<2) && (index_arg<8));
133 inline bool hasChild (
unsigned char buffer_arg,
unsigned char index_arg)
const
135 assert( (buffer_arg<2) && (index_arg<8));
225 template<
typename LeafContainerT = int,
335 createLeaf (
unsigned int idx_x_arg,
unsigned int idx_y_arg,
unsigned int idx_z_arg);
345 findLeaf (
unsigned int idx_x_arg,
unsigned int idx_y_arg,
unsigned int idx_z_arg);
354 existLeaf (
unsigned int idx_x_arg,
unsigned int idx_y_arg,
unsigned int idx_z_arg)
const;
362 removeLeaf (
unsigned int idx_x_arg,
unsigned int idx_y_arg,
unsigned int idx_z_arg);
409 bool do_XOR_encoding_arg =
false);
418 std::vector<LeafContainerT*>& leaf_container_vector_arg,
419 bool do_XOR_encoding_arg =
false);
425 serializeLeafs (std::vector<LeafContainerT*>& leaf_container_vector_arg);
439 bool do_XOR_decoding_arg =
false);
448 std::vector<LeafContainerT*>& leaf_container_vector_arg,
449 bool do_XOR_decoding_arg =
false);
468 inline LeafContainerT*
471 LeafContainerT* result = 0;
481 inline LeafContainerT*
540 unsigned char child_idx_arg)
const
567 for (i = 0; i < 8; i++)
570 node_bits |=
static_cast<char> ( (!!child) << i);
582 unsigned char bufferSelector_arg)
const
589 for (i = 0; i < 8; i++)
592 node_bits |=
static_cast<char> ( (!!child) << i);
609 node_bits[0] = node_bits[1] = 0;
611 for (i = 0; i < 8; i++)
616 node_bits[0] |=
static_cast<char> ( (!!childA) << i);
617 node_bits[1] |=
static_cast<char> ( (!!childB) << i);
620 return node_bits[0] ^ node_bits[1];
638 unsigned char buffer_selector_arg,
639 unsigned char child_idx_arg)
641 if (branch_arg.
hasChild(buffer_selector_arg, child_idx_arg))
653 delete (branchChild);
660 delete (branchChild);
668 branch_arg.
setChildPtr(buffer_selector_arg, child_idx_arg, 0);
689 for (i = 0; i < 8; i++)
715 unsigned char child_idx_arg)
720 static_cast<OctreeNode*> (new_branch_child));
722 return new_branch_child;
737 return new_leaf_child;
755 unsigned int depth_mask_arg,
759 bool branch_reset_arg =
false);
771 unsigned int depth_mask_arg,
773 LeafContainerT*& result_arg)
const;
784 unsigned int depth_mask_arg,
798 std::vector<char>* binary_tree_out_arg,
799 typename std::vector<LeafContainerT*>* leaf_container_vector_arg,
800 bool do_XOR_encoding_arg =
false,
801 bool new_leafs_filter_arg =
false);
816 unsigned int depth_mask_arg,
818 typename std::vector<char>::const_iterator& binary_tree_in_it_arg,
819 typename std::vector<char>::const_iterator& binary_tree_in_it_end_arg,
820 typename std::vector<LeafContainerT*>::const_iterator* leaf_container_vector_it_arg,
821 typename std::vector<LeafContainerT*>::const_iterator* leaf_container_vector_it_end_arg,
822 bool branch_reset_arg =
false,
823 bool do_XOR_decoding_arg =
false);
858 inline double Log2 (
double n_arg)
860 return log (n_arg) / log (2.0);
876 unsigned char mask = 1;
879 for (
int i = 0; i < 8; i++)
882 std::cout << ((data_arg & (mask << i)) ?
"1" :
"0");
884 std::cout << std::endl;