removeOld() not working? Or locationCount not decrementing after removeOld()?
Fragment of a discussion from User talk:Rednaxela/kD-Tree
Jump to navigation
Jump to search
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.
Ojd