Skip to content

add a quadtree to find neighbouring atoms faster#94

Open
dickloraine wants to merge 1 commit into
hunar4321:mainfrom
dickloraine:quadtree
Open

add a quadtree to find neighbouring atoms faster#94
dickloraine wants to merge 1 commit into
hunar4321:mainfrom
dickloraine:quadtree

Conversation

@dickloraine

Copy link
Copy Markdown

Hi, very nice project! I implemented a quadtree to make use of the effect radius being limited. This way finding nearby atoms is much faster, as long as the radii aren't huge. This quadtree only queries rectangles, so the distance check in applyRules is still neccessary, but this should still be faster than checking for circular intersections.

One could add gui-controlls for this, but this is only for performance and has nothing to do with the core functionality. But there is one case, where this would be slower than the current way. If the radii are large, so that nearly all atoms have to be checked anyways, this just adds overhead.

For large numbers of atoms with the default radius, this is a 3-5 times improvement in fps.

@ker2x

ker2x commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

Oh that's amazing i never took the time to do it !

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.

2 participants