Bug Fixed in the function doQueryK if the point cloud contains less than k points

This commit is contained in:
Gianpaolo Palma 2016-04-28 10:48:19 +00:00
parent eac3243375
commit 694ffd7cb0
1 changed files with 4 additions and 5 deletions

View File

@ -199,7 +199,6 @@ namespace vcg {
{ {
mNeighborQueue.setMaxSize(k); mNeighborQueue.setMaxSize(k);
mNeighborQueue.init(); mNeighborQueue.init();
mNeighborQueue.insert(0xffffffff, std::numeric_limits<Scalar>::max());
QueryNode mNodeStack[64]; QueryNode mNodeStack[64];
mNodeStack[0].nodeId = 0; mNodeStack[0].nodeId = 0;
@ -217,9 +216,9 @@ namespace vcg {
Node& node = mNodes[qnode.nodeId]; Node& node = mNodes[qnode.nodeId];
//if the distance is less than the top of the max-heap, it could be one of the k-nearest neighbours //if the distance is less than the top of the max-heap, it could be one of the k-nearest neighbours
if (qnode.sq < mNeighborQueue.getTopWeight()) if (mNeighborQueue.getNofElements() < k || qnode.sq < mNeighborQueue.getTopWeight())
{ {
//when we arrive to a lef //when we arrive to a leaf
if (node.leaf) if (node.leaf)
{ {
--count; //pop of the leaf --count; //pop of the leaf