本文整理汇总了C++中OcTree::setResolution方法的典型用法代码示例。如果您正苦于以下问题:C++ OcTree::setResolution方法的具体用法?C++ OcTree::setResolution怎么用?C++ OcTree::setResolution使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OcTree
的用法示例。
在下文中一共展示了OcTree::setResolution方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
if (argc != 2){
std::cerr << "Error: you need to specify a testfile (.bt) as argument to read" << std::endl;
return 1; // exit 1 means failure
}
std::cout << "Testing empty OcTree...\n";
//empty tree
{
OcTree emptyTree(0.999);
EXPECT_EQ(emptyTree.size(), 0);
EXPECT_TRUE(emptyTree.writeBinary("empty.bt"));
EXPECT_TRUE(emptyTree.write("empty.ot"));
OcTree emptyReadTree(0.2);
EXPECT_TRUE(emptyReadTree.readBinary("empty.bt"));
EXPECT_EQ(emptyReadTree.size(), 0);
EXPECT_TRUE(emptyTree == emptyReadTree);
AbstractOcTree* readTreeAbstract = AbstractOcTree::read("empty.ot");
EXPECT_TRUE(readTreeAbstract);
OcTree* readTreeOt = dynamic_cast<OcTree*>(readTreeAbstract);
EXPECT_TRUE(readTreeOt);
EXPECT_EQ(readTreeOt->size(), 0);
EXPECT_TRUE(emptyTree == *readTreeOt);
delete readTreeOt;
}
std::cout << "Testing reference OcTree from file ...\n";
string filename = string(argv[1]);
{
string filenameOt = "test_io_file.ot";
string filenameBtOut = "test_io_file.bt";
string filenameBtCopyOut = "test_io_file_copy.bt";
// read reference tree from input file
OcTree tree (0.1);
EXPECT_TRUE (tree.readBinary(filename));
std::cout << " Copy Constructor / assignment / ==\n";
// test copy constructor / assignment:
OcTree* treeCopy = new OcTree(tree);
EXPECT_TRUE(tree == *treeCopy);
EXPECT_TRUE(treeCopy->writeBinary(filenameBtCopyOut));
// change a tree property, trees must be different afterwards
treeCopy->setResolution(tree.getResolution()*2.0);
EXPECT_FALSE(tree == *treeCopy);
treeCopy->setResolution(tree.getResolution());
EXPECT_TRUE(tree == *treeCopy);
// flip one value, trees must be different afterwards:
point3d pt(0.5, 0.5, 0.5);
OcTreeNode* node = treeCopy->search(pt);
if (node && treeCopy->isNodeOccupied(node))
treeCopy->updateNode(pt, false);
else
treeCopy->updateNode(pt, true);
EXPECT_FALSE(tree == *treeCopy);
delete treeCopy;
std::cout << " Swap\n";
// test swap:
OcTree emptyT(tree.getResolution());
OcTree emptySw(emptyT);
OcTree otherSw(tree);
emptySw.swapContent(otherSw);
EXPECT_FALSE(emptyT == emptySw);
EXPECT_TRUE(emptySw == tree);
EXPECT_TRUE(otherSw == emptyT);
// write again to bt, read & compare
EXPECT_TRUE(tree.writeBinary(filenameBtOut));
OcTree readTreeBt(0.1);
EXPECT_TRUE(readTreeBt.readBinary(filenameBtOut));
EXPECT_TRUE(tree == readTreeBt);
std::cout <<" Write to .ot / read through AbstractOcTree\n";
// now write to .ot, read & compare
EXPECT_TRUE(tree.write(filenameOt));
AbstractOcTree* readTreeAbstract = AbstractOcTree::read(filenameOt);
EXPECT_TRUE(readTreeAbstract);
OcTree* readTreeOt = dynamic_cast<OcTree*>(readTreeAbstract);
EXPECT_TRUE(readTreeOt);
EXPECT_TRUE(tree == *readTreeOt);
// sanity test for "==": flip one node, compare again
point3d coord(0.1f, 0.1f, 0.1f);
node = readTreeOt->search(coord);
if (node && readTreeOt->isNodeOccupied(node))
readTreeOt->updateNode(coord, false);
//.........这里部分代码省略.........