| 125 | } |
| 126 | |
| 127 | bool ColorOcTree::isNodeCollapsible(const ColorOcTreeNode* node) const{ |
| 128 | // all children must exist, must not have children of |
| 129 | // their own and have the same occupancy probability |
| 130 | if (!nodeChildExists(node, 0)) |
| 131 | return false; |
| 132 | |
| 133 | const ColorOcTreeNode* firstChild = getNodeChild(node, 0); |
| 134 | if (nodeHasChildren(firstChild)) |
| 135 | return false; |
| 136 | |
| 137 | for (unsigned int i = 1; i<8; i++) { |
| 138 | // compare nodes only using their occupancy, ignoring color for pruning |
| 139 | if (!nodeChildExists(node, i) || nodeHasChildren(getNodeChild(node, i)) || !(getNodeChild(node, i)->getValue() == firstChild->getValue())) |
| 140 | return false; |
| 141 | } |
| 142 | |
| 143 | return true; |
| 144 | } |
| 145 | |
| 146 | ColorOcTreeNode* ColorOcTree::averageNodeColor(const OcTreeKey& key, |
| 147 | uint8_t r, |