Difference between revisions of "Thread:User talk:Rednaxela/kD-Tree/removeOld() not working? Or locationCount not decrementing after removeOld()?/reply (2)"

From Robowiki
Jump to navigation Jump to search
 
(No difference)

Latest revision as of 17:09, 7 May 2012

I found the error. In method RemoveOld, the loop condition of the decrementing loop should be

   cursor != null    // OK

instead of

   cursor.parent != null     // WRONG

This prevented the count in the root node of being decremented.

Whole loop (corrected):

   do {
       cursor.locationCount--;
       cursor = cursor.parent;
   } while (cursor != null);

Also RemoveOld does not adapt minLimit and maxLimit. I don't know what the impact of this would be in practice.