After calling kdtree.Clear(), the kdtree.Count is not set to 0
The code of the Clear function is below, it need to add the line of code with Count = 0 public void Clear() { if (root != null) RemoveChildNodes(root); }
I've just come across the same as when using .balance, the tree count doubles. Reviewing source, I don't think it is. It's jsut the count is not reset or reduced as the child nodes are removed.
I've updated the source my side to :
public void Clear()
{
if (root != null)
{
RemoveChildNodes(root);
this.Count = 0;
}
}
And will test this.
So far, the library seems great, though. Useful. Not sure if it is maintained any more or not, but definitely doing the job for me in most places so far.
Seems to work, though my tree count has reduced by 1 after balance. Not sure why this is. Perhaps Count should not be zero, or rebalance is in fact discarding one of my elements somewhere. I'll test some more!