本文整理汇总了C++中NodeHandle::addPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeHandle::addPoint方法的具体用法?C++ NodeHandle::addPoint怎么用?C++ NodeHandle::addPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeHandle
的用法示例。
在下文中一共展示了NodeHandle::addPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addPointRecursive
void TreeFastCache::addPointRecursive(const double pt[3], const double color[3], double point_accuracy)
{
NodeHandle* nh = top().nh;
assert(nh);
double node_cell_size = nh->getNodeGeometry().getSize();
// adds point to empty node
if (nh->isEmpty() && point_accuracy >= node_cell_size / BITS_D)
{
nh->setPoint(pt, color);
return;
}
// reached maximum resultion of the tree
if (node_cell_size < tree.getMinCellSize())
{
nh->addPoint(pt, color);
return;
}
// this node is a leaf, and we need to copy the original point one level down
if (!nh->isEmpty() && nh->isLeaf())
{
// Determines which child the point should be added to.
uint8_t original_child = nh->getChildForNodePoint();
NodeHandle new_leaf;
tree.createChildNode(*nh, original_child, new_leaf);
nh->getNode()->copyToChildNode(original_child, new_leaf.getNode());
tree.releaseNode(new_leaf);
}
// Gets the child node to recurse on.
uint8_t new_child = nh->getNodeGeometry().whichChild(pt);
NodeHandle* new_child_nh = NULL;
if (nh->hasChild(new_child)) {
new_child_nh = tree.getChildNode(*nh, new_child);
new_child_nh->waitUntilLoaded();
}
else {
new_child_nh = tree.createChildNode(*nh, new_child);
}
// recursion to add point to child
push(NodeCache(new_child_nh));
addPointRecursive(pt, color, point_accuracy);
}