Skip to content

add a quadtree to find neighbouring atoms faster #94

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dickloraine
Copy link

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
Copy link
Contributor

ker2x commented Feb 11, 2025

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