本文整理汇总了C++中OcTree::begin_leafs_bbx方法的典型用法代码示例。如果您正苦于以下问题:C++ OcTree::begin_leafs_bbx方法的具体用法?C++ OcTree::begin_leafs_bbx怎么用?C++ OcTree::begin_leafs_bbx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OcTree
的用法示例。
在下文中一共展示了OcTree::begin_leafs_bbx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
gettimeofday(&start, NULL); // start timers
count = 0;
for(OcTree::iterator it = tree->begin(maxDepth), end=tree->end();
it!= end; ++it){
// do something:
// std::cout << it.getDepth() << " " << " "<<it.getCoordinate()<< std::endl;
count++;
}
gettimeofday(&stop, NULL); // stop timer
time_it = timediff(start, stop);
std::cout << "Time to traverse all leafs at max depth " <<(unsigned int)maxDepth <<" ("<<count<<" nodes): "<< time_it << " s\n\n";
/**
* bounding box tests
*/
//tree->expand();
// test complete tree (should be equal to no bbx)
OcTreeKey bbxMinKey, bbxMaxKey;
double temp_x,temp_y,temp_z;
tree->getMetricMin(temp_x,temp_y,temp_z);
octomap::point3d bbxMin(temp_x,temp_y,temp_z);
tree->getMetricMax(temp_x,temp_y,temp_z);
octomap::point3d bbxMax(temp_x,temp_y,temp_z);
EXPECT_TRUE(tree->coordToKeyChecked(bbxMin, bbxMinKey));
EXPECT_TRUE(tree->coordToKeyChecked(bbxMax, bbxMaxKey));
OcTree::leaf_bbx_iterator it_bbx = tree->begin_leafs_bbx(bbxMinKey,bbxMaxKey);
EXPECT_TRUE(it_bbx == tree->begin_leafs_bbx(bbxMinKey,bbxMaxKey));
OcTree::leaf_bbx_iterator end_bbx = tree->end_leafs_bbx();
EXPECT_TRUE(end_bbx == tree->end_leafs_bbx());
OcTree::leaf_iterator it = tree->begin_leafs();
EXPECT_TRUE(it == tree->begin_leafs());
OcTree::leaf_iterator end = tree->end_leafs();
EXPECT_TRUE(end == tree->end_leafs());
for( ; it!= end && it_bbx != end_bbx; ++it, ++it_bbx){
EXPECT_TRUE(it == it_bbx);
}
EXPECT_TRUE(it == end && it_bbx == end_bbx);
// now test an actual bounding box:
tree->expand(); // (currently only works properly for expanded tree (no multires)
bbxMin = point3d(-1, -1, - 1);
bbxMax = point3d(3, 2, 1);
EXPECT_TRUE(tree->coordToKeyChecked(bbxMin, bbxMinKey));
EXPECT_TRUE(tree->coordToKeyChecked(bbxMax, bbxMaxKey));
typedef unordered_ns::unordered_map<OcTreeKey, double, OcTreeKey::KeyHash> KeyVolumeMap;
KeyVolumeMap bbxVoxels;
count = 0;
for(OcTree::leaf_bbx_iterator it = tree->begin_leafs_bbx(bbxMinKey,bbxMaxKey), end=tree->end_leafs_bbx();
it!= end; ++it)
{
count++;