本文整理汇总了C++中Space::regionQuery方法的典型用法代码示例。如果您正苦于以下问题:C++ Space::regionQuery方法的具体用法?C++ Space::regionQuery怎么用?C++ Space::regionQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Space
的用法示例。
在下文中一共展示了Space::regionQuery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: localDBSCAN
Rules HPDBSCAN::localDBSCAN(const Space& space, const float epsilon, const size_t minPoints)
{
const float EPS2 = std::pow(epsilon, 2);
const size_t lower = 0;
const size_t upper = this->m_points.size();
Rules rules;
// local dbscan
size_t cell = NOT_VISITED;
std::vector<size_t> neighborPoints;
#pragma omp parallel for schedule(dynamic, 500) private(neighborPoints) firstprivate(cell) reduction(merge: rules)
for (size_t point = lower; point < upper; ++point)
{
size_t pointCell = this->m_points.cell(point);
if (pointCell != cell)
{
neighborPoints = space.getNeighbors(pointCell);
cell = pointCell;
}
std::vector<size_t> minPointsArea;
ssize_t clusterId = NOISE;
if(neighborPoints.size() >= minPoints)
{
clusterId =space.regionQuery(point, neighborPoints, EPS2, minPointsArea);
}
if (minPointsArea.size() >= minPoints)
{
this->m_points.cluster(point, clusterId, true);
for (size_t other : minPointsArea)
{
ssize_t otherClusterId = this->m_points.cluster(other);
if (this->m_points.corePoint(other))
{
const std::pair<Cluster, Cluster> minmax = std::minmax(otherClusterId, clusterId);
rules.update(minmax.second, minmax.first);
}
this->m_points.cluster(other, clusterId, false);
}
}
else if (this->m_points.cluster(point) == NOT_VISITED)
{
this->m_points.cluster(point, NOISE, false);
}
}
return rules;
}