9 int main(
int argc,
char** argv) {
13 point3d singlePt(-0.05f, -0.02f, 1.0f);
22 for (key[2] = singleKey[2] - 1; key[2] <= singleKey[2] + 1; ++key[2]){
23 for (key[1] = singleKey[1] - 1; key[1] <= singleKey[1] + 1; ++key[1]){
24 for (key[0] = singleKey[0] - 1; key[0] <= singleKey[0] + 1; ++key[0]){
25 if (key != singleKey){
38 for (key[2] = singleKey[2] - 1; key[2] <= singleKey[2] + 1; ++key[2]){
39 for (key[1] = singleKey[1] - 1; key[1] <= singleKey[1] + 1; ++key[1]){
40 for (key[0] = singleKey[0] - 1; key[0] <= singleKey[0] + 1; ++key[0]){
41 if (key != singleKey){
63 for (key[2] = singleKey[2] - 1; key[2] <= singleKey[2] + 1; ++key[2]){
64 for (key[1] = singleKey[1] - 1; key[1] <= singleKey[1] + 1; ++key[1]){
65 for (key[0] = singleKey[0] - 1; key[0] <= singleKey[0] + 1; ++key[0]){
66 if (key == singleKey){
70 }
else if (key == singleKey2){
85 for (key[2] = singleKey[2] - 1; key[2] <= singleKey[2] + 1; ++key[2]){
86 for (key[1] = singleKey[1] - 1; key[1] <= singleKey[1] + 1; ++key[1]){
87 for (key[0] = singleKey[0] - 1; key[0] <= singleKey[0] + 1; ++key[0]){
88 if (key == singleKey){
92 }
else if (key == singleKey2){
128 for (
float x=0.005f; x <= 0.32f; x+=res){
129 for (
float y=0.005f; y <= 0.32f; y+=res){
130 for (
float z=0.005f; z <= 0.32f; z+=res){
149 for (
float x=0.005f; x <= 0.32f; x+=res){
150 for (
float y=0.005f; y <= 0.32f; y+=res){
151 for (
float z=0.005f; z <= 0.32f; z+=res){
163 for (
float x=0.005f; x <= 0.32f; x+=res){
164 for (
float y=0.005f; y <= 0.32f; y+=res){
165 for (
float z=0.005f; z <= 0.32f; z+=res){
177 std::cout <<
"\nCreating / deleting nodes\n===============================\n";
178 size_t initialSize = tree.
size();
182 point3d newCoord(-2.0, -2.0, -2.0);
186 size_t insertedSize = tree.
size();
187 std::cout <<
"Size after one insertion: " << insertedSize << std::endl;
197 for (
size_t i = 0; i < 7; ++i){
206 const float value = 0.123f;
207 newNodeCreated->setValue(value);
208 tree.
write(
"pruning_test_edited.ot");
237 tree.
write(
"pruning_test_out.ot");
238 std::cerr <<
"Test successful.\n";
virtual NODE * updateNode(const OcTreeKey &key, float log_odds_update, bool lazy_eval=false)
void deleteNodeChild(NODE *node, unsigned int childIdx)
Deletes the i-th child of the node.
NODE * search(double x, double y, double z, unsigned int depth=0) const
unsigned int getTreeDepth() const
bool coordToKeyChecked(const point3d &coord, OcTreeKey &key) const
NODE * createNodeChild(NODE *node, unsigned int childIdx)
Creates (allocates) the i-th child of the node.
#define EXPECT_FALSE(args)
bool nodeHasChildren(const NODE *node) const
virtual void expandNode(NODE *node)
bool write(const std::string &filename) const
Write file header and complete tree to file (serialization)
This class represents a three-dimensional vector.
int main(int argc, char **argv)
octomath::Vector3 point3d
Use Vector3 (float precision) as a point3d in octomap.
bool nodeChildExists(const NODE *node, unsigned int childIdx) const
virtual bool pruneNode(NODE *node)
#define EXPECT_TRUE(args)
size_t calcNumNodes() const
Traverses the tree to calculate the total number of nodes.
bool isNodeOccupied(const OcTreeNode *occupancyNode) const
queries whether a node is occupied according to the tree's parameter for "occupancy" ...
virtual size_t size() const