9 int main(
int argc,
char** argv) {
17 point3d singlePt(-0.05f, -0.02f, 1.0f);
26 for (key[2] = singleKey[2] - 1; key[2] <= singleKey[2] + 1; ++key[2]){
27 for (key[1] = singleKey[1] - 1; key[1] <= singleKey[1] + 1; ++key[1]){
28 for (key[0] = singleKey[0] - 1; key[0] <= singleKey[0] + 1; ++key[0]){
29 if (key != singleKey){
42 for (key[2] = singleKey[2] - 1; key[2] <= singleKey[2] + 1; ++key[2]){
43 for (key[1] = singleKey[1] - 1; key[1] <= singleKey[1] + 1; ++key[1]){
44 for (key[0] = singleKey[0] - 1; key[0] <= singleKey[0] + 1; ++key[0]){
45 if (key != singleKey){
67 for (key[2] = singleKey[2] - 1; key[2] <= singleKey[2] + 1; ++key[2]){
68 for (key[1] = singleKey[1] - 1; key[1] <= singleKey[1] + 1; ++key[1]){
69 for (key[0] = singleKey[0] - 1; key[0] <= singleKey[0] + 1; ++key[0]){
70 if (key == singleKey){
74 }
else if (key == singleKey2){
89 for (key[2] = singleKey[2] - 1; key[2] <= singleKey[2] + 1; ++key[2]){
90 for (key[1] = singleKey[1] - 1; key[1] <= singleKey[1] + 1; ++key[1]){
91 for (key[0] = singleKey[0] - 1; key[0] <= singleKey[0] + 1; ++key[0]){
92 if (key == singleKey){
96 }
else if (key == singleKey2){
132 for (
float x=0.005f; x <= 0.32f; x+=res){
133 for (
float y=0.005f; y <= 0.32f; y+=res){
134 for (
float z=0.005f; z <= 0.32f; z+=res){
153 for (
float x=0.005f; x <= 0.32f; x+=res){
154 for (
float y=0.005f; y <= 0.32f; y+=res){
155 for (
float z=0.005f; z <= 0.32f; z+=res){
167 for (
float x=0.005f; x <= 0.32f; x+=res){
168 for (
float y=0.005f; y <= 0.32f; y+=res){
169 for (
float z=0.005f; z <= 0.32f; z+=res){
181 std::cout <<
"\nCreating / deleting nodes\n===============================\n";
182 size_t initialSize = tree.
size();
186 point3d newCoord(-2.0, -2.0, -2.0);
190 size_t insertedSize = tree.
size();
191 std::cout <<
"Size after one insertion: " << insertedSize << std::endl;
201 for (
size_t i = 0; i < 7; ++i){
210 const float value = 0.123f;
211 newNodeCreated->setValue(value);
212 tree.
write(
"pruning_test_edited.ot");
241 tree.
write(
"pruning_test_out.ot");
244 std::cout <<
"\nClearing tree / recursive delete\n===============================\n";
260 tree.
write(
"pruning_test_out.ot");
261 std::cerr <<
"Test successful.\n";
size_t calcNumNodes() const
Traverses the tree to calculate the total number of nodes.
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 * createNodeChild(NODE *node, unsigned int childIdx)
Creates (allocates) the i-th child of the node.
#define EXPECT_FALSE(args)
NODE * search(double x, double y, double z, unsigned int depth=0) const
bool coordToKeyChecked(const point3d &coord, OcTreeKey &key) const
virtual void expandNode(NODE *node)
This class represents a three-dimensional vector.
void clear()
Deletes the complete tree structure.
int main(int argc, char **argv)
octomath::Vector3 point3d
Use Vector3 (float precision) as a point3d in octomap.
virtual size_t size() const
bool write(const std::string &filename) const
Write file header and complete tree to file (serialization)
virtual bool pruneNode(NODE *node)
bool isNodeOccupied(const OcTreeNode *occupancyNode) const
queries whether a node is occupied according to the tree's parameter for "occupancy" ...
#define EXPECT_TRUE(args)
bool nodeChildExists(const NODE *node, unsigned int childIdx) const
bool nodeHasChildren(const NODE *node) const
unsigned int getTreeDepth() const