quil / quil-site

Source code of quil.info
http://quil.info
Eclipse Public License 1.0
7 stars 13 forks source link

new sketch: n-body simulation of self-gravitating star cluster #35

Closed Nephas closed 5 years ago

Nephas commented 5 years ago

Hej, out of a hobby interest I wrote a n-body gravity simulation in clojure and the visualization with quil has been a joy. I'd love to see it on the website. Keep up the great work!

nbeloglazov commented 5 years ago

Hi Marco. The sketch looks great! And pretty smooth given the number of stars.

Before I merge, have a couple of questions:

  1. Why do you display quadtree? It distracts a little bit from the dots.
  2. Docstrings in clojure go before arguments list. Personally it's kinda confusing but that's how it is. Your functions have most docs after argument list.
  3. You usage of update-state is somewhat odd. update-state supposed to return new state while your implementation both updates global store atom and returns its old state. Is that intentional? I think if you remove store it should still work.
Nephas commented 5 years ago

Hi Nikita, Thanks for the quick review. I'll incorporate your comments and also found a bug which prevented proper n-body interaction - cleaning things up might take until next week.

  1. I found the tree interesting by itself, but you're right - I'll make it toggleable.
  2. Will do.
  3. I was using the store atom to accessing the state from the REPL for development. Is there another way to achieve this in Quil? But yes, in the running application there's really no use for it - I'll remove it. Cheers.
nbeloglazov commented 5 years ago

Marco, I merged your sketch and fixed the issues. Deployed to live: http://quil.info/?example=cluster Btw it would be great to provide some link to wiki or any other page that describes what your sketch does. Given that it actually simulates some physics - it would be quite interesting. For example in one of my sketches I gave link to a blog post describing what it does: http://quil.info/sketches/show/example_equilibrium

Thanks again for the great sketch!