本文整理汇总了C++中AlignedPointTVector::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ AlignedPointTVector::empty方法的具体用法?C++ AlignedPointTVector::empty怎么用?C++ AlignedPointTVector::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlignedPointTVector
的用法示例。
在下文中一共展示了AlignedPointTVector::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pow
//loads chunks of up to 2e9 pts at a time; this is a completely arbitrary number
template<typename Container, typename PointT> void
octree_base<Container, PointT>::buildLOD (octree_base_node<Container, PointT>** current_branch, const int current_dims)
{
//stop if this brach DNE
if (!current_branch[current_dims - 1])
{
return;
}
if ((current_branch[current_dims - 1]->numchildren () == 0)
&& (!current_branch[current_dims - 1]->hasUnloadedChildren ()))//at leaf: subsample, remove, and copy to higher nodes
{
//this node's idx is (current_dims-1)
octree_base_node<Container, PointT>* leaf = current_branch[current_dims - 1];
boost::uint64_t leaf_start_size = leaf->payload->size ();
if (leaf_start_size > 0)//skip empty
{
for (boost::uint64_t startp = 0; startp < leaf_start_size; startp += LOAD_COUNT_)
{
//there are (current_dims-1) nodes above this one, indexed 0 thru (current_dims-2)
for (size_t level = (current_dims - 1); level >= 1; level--)
{
//the target
octree_base_node<Container, PointT>* target_parent = current_branch[level - 1];
//the percent to copy
//each level up the chain gets sample_precent^l of the leaf's data
double percent = pow (double (octree_base_node<Container, PointT>::sample_precent), double (current_dims - level));
//read in percent of node
AlignedPointTVector v;
if ((startp + LOAD_COUNT_) < leaf_start_size)
{
leaf->payload->readRangeSubSample (startp, LOAD_COUNT_, percent, v);
}
else
{
leaf->payload->readRangeSubSample (startp, leaf_start_size - startp, percent, v);
}
//write to the target
if (!v.empty ())
{
target_parent->payload->insertRange ( v );
// target_parent->payload->insertRange (&(v.front ()), v.size ());
this->incrementPointsInLOD (target_parent->depth, v.size ());
}
}
}
}
}
else//not at leaf, keep going down
{
//clear this node, in case we are updating the LOD
current_branch[current_dims - 1]->payload->clear ();
const int next_dims = current_dims + 1;
octree_base_node<Container, PointT>** next_branch = new octree_base_node<Container, PointT>*[next_dims];
memcpy (next_branch, current_branch, current_dims * sizeof(octree_base_node<Container, PointT>**));
size_t numchild = current_branch[current_dims - 1]->numchildren ();
if ((numchild != 8) && (current_branch[current_dims - 1]->hasUnloadedChildren ()))
{
current_branch[current_dims - 1]->loadChildren (false);
numchild = current_branch[current_dims - 1]->numchildren ();
}
for (size_t i = 0; i < numchild; i++)
{
next_branch[next_dims - 1] = next_branch[current_dims - 1]->children[i];
buildLOD (next_branch, next_dims);
}
delete[] next_branch;
}
}