本文整理汇总了C++中Octree::NumChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ Octree::NumChildren方法的具体用法?C++ Octree::NumChildren怎么用?C++ Octree::NumChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Octree
的用法示例。
在下文中一共展示了Octree::NumChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scores
void Octree<MetricType, StatisticType, MatType>::SingleTreeTraverser<RuleType>::
Traverse(const size_t queryIndex, Octree& referenceNode)
{
// If we are a leaf, run the base cases.
if (referenceNode.NumChildren() == 0)
{
const size_t refBegin = referenceNode.Point(0);
const size_t refEnd = refBegin + referenceNode.NumPoints();
for (size_t r = refBegin; r < refEnd; ++r)
rule.BaseCase(queryIndex, r);
}
else
{
// Do a prioritized recursion, by scoring all candidates and then sorting
// them.
arma::vec scores(referenceNode.NumChildren());
for (size_t i = 0; i < scores.n_elem; ++i)
scores[i] = rule.Score(queryIndex, referenceNode.Child(i));
// Sort the scores.
arma::uvec sortedIndices = arma::sort_index(scores);
for (size_t i = 0; i < sortedIndices.n_elem; ++i)
{
// If the node is pruned, all subsequent nodes in sorted order will also
// be pruned.
if (scores[sortedIndices[i]] == DBL_MAX)
{
numPrunes += (sortedIndices.n_elem - i);
break;
}
Traverse(queryIndex, referenceNode.Child(sortedIndices[i]));
}
}
}
示例2: if
void Octree<MetricType, StatisticType, MatType>::DualTreeTraverser<RuleType>::
Traverse(Octree& queryNode, Octree& referenceNode)
{
// Increment the visit counter.
++numVisited;
// Store the current traversal info.
traversalInfo = rule.TraversalInfo();
if (queryNode.IsLeaf() && referenceNode.IsLeaf())
{
const size_t begin = queryNode.Point(0);
const size_t end = begin + queryNode.NumPoints();
for (size_t q = begin; q < end; ++q)
{
// First, see if we can prune the reference node for this query point.
rule.TraversalInfo() = traversalInfo;
const double score = rule.Score(q, referenceNode);
if (score == DBL_MAX)
{
++numPrunes;
continue;
}
const size_t rBegin = referenceNode.Point(0);
const size_t rEnd = rBegin + referenceNode.NumPoints();
for (size_t r = rBegin; r < rEnd; ++r)
rule.BaseCase(q, r);
numBaseCases += referenceNode.NumPoints();
}
}
else if (!queryNode.IsLeaf() && referenceNode.IsLeaf())
{
// We have to recurse down the query node. Order does not matter.
for (size_t i = 0; i < queryNode.NumChildren(); ++i)
{
rule.TraversalInfo() = traversalInfo;
const double score = rule.Score(queryNode.Child(i), referenceNode);
if (score == DBL_MAX)
{
++numPrunes;
continue;
}
Traverse(queryNode.Child(i), referenceNode);
}
}
else if (queryNode.IsLeaf() && !referenceNode.IsLeaf())
{
// We have to recurse down the reference node, so we need to do it in an
// ordered manner.
arma::vec scores(referenceNode.NumChildren());
std::vector<typename RuleType::TraversalInfoType>
tis(referenceNode.NumChildren());
for (size_t i = 0; i < referenceNode.NumChildren(); ++i)
{
rule.TraversalInfo() = traversalInfo;
scores[i] = rule.Score(queryNode, referenceNode.Child(i));
tis[i] = rule.TraversalInfo();
}
// Sort the scores.
arma::uvec scoreOrder = arma::sort_index(scores);
for (size_t i = 0; i < scoreOrder.n_elem; ++i)
{
if (scores[scoreOrder[i]] == DBL_MAX)
{
// We don't need to check any more---all children past here are pruned.
numPrunes += scoreOrder.n_elem - i;
break;
}
rule.TraversalInfo() = tis[scoreOrder[i]];
Traverse(queryNode, referenceNode.Child(scoreOrder[i]));
}
}
else
{
// We have to recurse down both the query and reference nodes. Query order
// does not matter, so we will do that in sequence. However we will
// allocate the arrays for recursion at this level.
arma::vec scores(referenceNode.NumChildren());
std::vector<typename RuleType::TraversalInfoType>
tis(referenceNode.NumChildren());
for (size_t j = 0; j < queryNode.NumChildren(); ++j)
{
// Now we have to recurse down the reference node, which we will do in a
// prioritized manner.
for (size_t i = 0; i < referenceNode.NumChildren(); ++i)
{
rule.TraversalInfo() = traversalInfo;
scores[i] = rule.Score(queryNode.Child(j), referenceNode.Child(i));
tis[i] = rule.TraversalInfo();
}
// Sort the scores.
arma::uvec scoreOrder = arma::sort_index(scores);
for (size_t i = 0; i < scoreOrder.n_elem; ++i)
{
//.........这里部分代码省略.........