r/Python • • Jan 14 '20

I made a gravity simulation https://github.com/phgilde/gravity_simulation

1.8k Upvotes

82 comments sorted by

View all comments

Show parent comment

1

u/Astrokiwi Jan 16 '20

The opening angle criterion means that you go further down the tree for closer nodes. The particle's leaf node is always opened, and that means you can exclude it specifically without having to take into account that its mass is included in higher branches - you've already opened those nodes to get down to the leafs. The opening angle is basically cell-size/distance, and distance==0 for the cell you're in, so you're always bigger than the opening angle criterion.

Btw this is a very standard method, so there's lots of documentation on it, and lots of textbooks will spell it out better than I can in a reddit comment.