本文整理汇总了C++中NodePtr::getBucket方法的典型用法代码示例。如果您正苦于以下问题:C++ NodePtr::getBucket方法的具体用法?C++ NodePtr::getBucket怎么用?C++ NodePtr::getBucket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodePtr
的用法示例。
在下文中一共展示了NodePtr::getBucket方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findKNearestNeighbours
void KDTree::findKNearestNeighbours(const NodePtr& src, LimitedPriorityQueue& results,
const VertexPtr& target){
if(src->isLeaf()){
for(VertexPtr vrtx: src->getBucket()){
float dist = norm((*vrtx)-(*target));
results.push(VertexDistPair(vrtx, dist));
}
HyperSphere sphere(target, std::get<1>(results.top()), m_K);
//Required Number of points are found, sphere was completely in region,
//there can't be any closer results
if(results.full() && sphere.withinRegion(src->getDomain())){
return;
}
}
//Uncool, get sphere again
float dist = FLT_MAX;
if(!results.empty()){
dist = std::get<1>(results.top());
}
HyperSphere sphere(target, dist, m_K );
if(src->getLeft()){
if(sphere.intersectsRegion(src->getLeft()->getDomain())){
findKNearestNeighbours(src->getLeft(), results, target);
}
}
if(src->getRight()){
if(sphere.intersectsRegion(src->getRight()->getDomain())){
findKNearestNeighbours(src->getRight(), results, target);
}
};
};
示例2: findInRadius
void KDTree::findInRadius(const NodePtr& src, const HyperSphere& sphere,
VertexList& result) const{
if(src->isLeaf()){
for(VertexPtr vrtx : src->getBucket()){
if(sphere.contains(vrtx)){
result.push_back(vrtx);
}
}
}
if(src->getLeft() != nullptr){
if(sphere.intersectsRegion(src->getDomain())){
findInRadius(src->getLeft(), sphere, result);
}
}
if(src->getRight() != nullptr){
if(sphere.intersectsRegion(src->getDomain())){
findInRadius(src->getRight(), sphere, result);
}
}
}