本文整理汇总了C++中OcTree::getRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ OcTree::getRoot方法的具体用法?C++ OcTree::getRoot怎么用?C++ OcTree::getRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OcTree
的用法示例。
在下文中一共展示了OcTree::getRoot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
//##############################################################
string btFilename = "";
unsigned char maxDepth = 16;
// test timing:
timeval start;
timeval stop;
const unsigned char tree_depth(16);
const unsigned int tree_max_val(32768);
double time_it, time_depr;
if (argc <= 1|| argc >3 || strcmp(argv[1], "-h") == 0){
printUsage(argv[0]);
}
btFilename = std::string(argv[1]);
if (argc > 2){
maxDepth = (unsigned char)atoi(argv[2]);
}
maxDepth = std::min((unsigned char)16,maxDepth);
if (maxDepth== 0)
maxDepth = tree_depth;
// iterate over empty tree:
OcTree emptyTree(0.2);
EXPECT_EQ(emptyTree.size(), 0);
EXPECT_EQ(emptyTree.calcNumNodes(), 0);
size_t iteratedNodes = 0;
OcTree::tree_iterator t_it = emptyTree.begin_tree(maxDepth);
OcTree::tree_iterator t_end = emptyTree.end_tree();
EXPECT_TRUE (t_it == t_end);
for( ; t_it != t_end; ++t_it){
iteratedNodes++;
}
EXPECT_EQ(iteratedNodes, 0);
for(OcTree::leaf_iterator l_it = emptyTree.begin_leafs(maxDepth), l_end=emptyTree.end_leafs(); l_it!= l_end; ++l_it){
iteratedNodes++;
}
EXPECT_EQ(iteratedNodes, 0);
cout << "\nReading OcTree file\n===========================\n";
OcTree* tree = new OcTree(btFilename);
if (tree->size()<= 1){
std::cout << "Error reading file, exiting!\n";
return 1;
}
size_t count;
std::list<OcTreeVolume> list_depr;
std::list<OcTreeVolume> list_iterator;
/**
* get number of nodes:
*/
gettimeofday(&start, NULL); // start timer
size_t num_leafs_recurs = tree->getNumLeafNodes();
gettimeofday(&stop, NULL); // stop timer
time_depr = timediff(start, stop);
gettimeofday(&start, NULL); // start timer
size_t num_leafs_it = 0;
for(OcTree::leaf_iterator it = tree->begin(), end=tree->end(); it!= end; ++it) {
num_leafs_it++;
}
gettimeofday(&stop, NULL); // stop timer
time_it = timediff(start, stop);
std::cout << "Number of leafs: " << num_leafs_it << " / " << num_leafs_recurs << ", times: "
<<time_it << " / " << time_depr << "\n========================\n\n";
/**
* get all occupied leafs
*/
point3d tree_center;
tree_center(0) = tree_center(1) = tree_center(2)
= (float) (((double) tree_max_val) * tree->getResolution());
gettimeofday(&start, NULL); // start timer
getLeafNodesRecurs(list_depr,maxDepth,tree->getRoot(), 0, tree_center, tree_center, tree, true);
gettimeofday(&stop, NULL); // stop timer
time_depr = timediff(start, stop);
gettimeofday(&start, NULL); // start timer
for(OcTree::iterator it = tree->begin(maxDepth), end=tree->end(); it!= end; ++it){
if(tree->isNodeOccupied(*it))
{
//count ++;
//.........这里部分代码省略.........