本文整理汇总了C++中OcTree::getNormals方法的典型用法代码示例。如果您正苦于以下问题:C++ OcTree::getNormals方法的具体用法?C++ OcTree::getNormals怎么用?C++ OcTree::getNormals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OcTree
的用法示例。
在下文中一共展示了OcTree::getNormals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
cout << endl;
cout << "generating example map" << endl;
OcTree tree (0.1); // create empty tree with resolution 0.1
// insert some measurements of occupied cells
for (int x=-20; x<20; x++) {
for (int y=-20; y<20; y++) {
for (int z=-20; z<20; z++) {
point3d endpoint ((float) x*0.05f, (float) y*0.05f, (float) z*0.05f);
tree.updateNode(endpoint, true); // integrate 'occupied' measurement
}
}
}
// insert some measurements of free cells
for (int x=-30; x<30; x++) {
for (int y=-30; y<30; y++) {
for (int z=-30; z<30; z++) {
point3d endpoint ((float) x*0.02f-1.0f, (float) y*0.02f-1.0f, (float) z*0.02f-1.0f);
tree.updateNode(endpoint, false); // integrate 'free' measurement
}
}
}
cout << endl;
cout << "performing some queries around the desired voxel:" << endl;
point3d query;
OcTreeNode* result = NULL;
for(float z = -0.6; z < -0.21; z += 0.1){
for(float y = -0.6; y < -0.21; y += 0.1){
for(float x = -0.6; x < -0.21; x += 0.1){
query = point3d(x, y, z);
result = tree.search(query);
print_query_info(query, result);
}
}
}
query = point3d(-0.5, -0.4, -0.4);
result = tree.search(query);
vector<point3d> normals;
if (tree.getNormals(query, normals)){
cout << endl;
string s_norm = (normals.size() > 1) ? " normals " : " normal ";
cout << "MC algorithm gives " << normals.size() << s_norm << "in voxel at " << query << endl;
for(unsigned i = 0; i < normals.size(); ++i)
cout << "\t" << normals[i].x() << "; " << normals[i].y() << "; " << normals[i].z() << endl;
} else{
cout << "query point unknown (no normals)\n";
}
}