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

Ensure _chooseSplitIndex always return a number #94

Merged
merged 1 commit into from
Jul 31, 2019

Conversation

DiogoDoreto
Copy link
Contributor

Fix #69

Current implementation of _chooseSplitIndex may return undefined when all children have infinity area.

When all inserted rects are infinity, they will be all inserted in a single node, instead of properly balancing the tree (updated test to validate this).

When data is random, an incorrect split may occur in a non-leaf node, causing a non-leaf node to have 0 children and causing error #69 when the tree will try to insert new data in its path.

This fix ensure that _chooseSplitIndex always return a number.

Copy link
Owner

@mourner mourner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic, thank you so much for finding a great fix!

@mourner mourner merged commit 15c31bd into mourner:master Jul 31, 2019
@borodaev
Copy link

borodaev commented Aug 7, 2019

Great!

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.

Rare error on insert (need help reproducing)
3 participants