Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to fix remove func #25 #31

Closed
wants to merge 1 commit into from

Conversation

mariosgit
Copy link

@mariosgit mariosgit commented Dec 9, 2022

Findings:

buildTree

When given a set of points with same coordinates in a dimension, they end up in left and right part of the tree. Is this within spec? Not sure. However the nodeSearch function expects exactly this and will fail and returns nothing, thus nothing is removed.

My fix is a search for differences in the coordinates and split there. This can lead to unbalanced trees, optimizing is left to the user :)

removeNode

This function resorts the tree when a root node is removed, results where strange, I skipped it and instead I rebuild the subtree using the buildTree func.

Sideeffects

Sorry my editor did reformat some of the code.

Did not rebuild min.js

@mariosgit
Copy link
Author

My usecase looked like this, in the jsfiddle it seems to work.

https://jsfiddle.net/rphak8ut/34/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant