46 cout <<
"occupancy probability at " << query <<
":\t " << node->
getOccupancy() << endl;
49 cout <<
"occupancy probability at " << query <<
":\t is unknown" << endl;
52 int main(
int argc,
char** argv) {
55 cout <<
"generating example map" << endl;
62 for (
int x=-20; x<20; x++) {
63 for (
int y=-20; y<20; y++) {
64 for (
int z=-20; z<20; z++) {
65 point3d endpoint ((
float) x*0.05f, (
float) y*0.05f, (
float) z*0.05f);
73 for (
int x=-30; x<30; x++) {
74 for (
int y=-30; y<30; y++) {
75 for (
int z=-30; z<30; z++) {
76 point3d endpoint ((
float) x*0.02f-1.0f, (
float) y*0.02f-1.0f, (
float) z*0.02f-1.0f);
83 cout <<
"performing some queries around the desired voxel:" << endl;
88 for(
float z = -0.6f; z < -0.21f; z += 0.1f){
89 for(
float y = -0.6f; y < -0.21f; y += 0.1f){
90 for(
float x = -0.6f; x < -0.21f; x += 0.1f){
92 result = tree.
search(query);
98 query =
point3d(-0.5f, -0.4f, -0.4f);
99 result = tree.
search(query);
101 vector<point3d> normals;
105 string s_norm = (normals.size() > 1) ?
" normals " :
" normal ";
106 cout <<
"MC algorithm gives " << normals.size() << s_norm <<
"in voxel at " << query << endl;
107 for(
unsigned i = 0; i < normals.size(); ++i)
108 cout <<
"\t" << normals[i].x() <<
"; " << normals[i].
y() <<
"; " << normals[i].z() << endl;
110 cout <<
"query point unknown (no normals)\n";
double getOccupancy() const
virtual NODE * updateNode(const OcTreeKey &key, float log_odds_update, bool lazy_eval=false)
void print_query_info(point3d query, OcTreeNode *node)
NODE * search(double x, double y, double z, unsigned int depth=0) const
bool getNormals(const point3d &point, std::vector< point3d > &normals, bool unknownStatus=true) const
This class represents a three-dimensional vector.
octomath::Vector3 point3d
Use Vector3 (float precision) as a point3d in octomap.
int main(int argc, char **argv)