Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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