Skip to content

NBody simulator on a HTML canvas where all calculation are performed via WASM Rust.

License

Notifications You must be signed in to change notification settings

Brandontam29/nbody-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nbody-simulator

NBody simulator on a HTML canvas where all calculation are performed via WASM Rust.

Time complexity

Naive algorithm is O(n^2). For every particle, we calculate the force that it has on every other one.

Barnes-Hut Algorithm is O(n logn). In short, this algorithm stores nodes into quadrants and pre-calculates the center of mass of clusters of particles. This enables calculating the force from a cluster as oppose to individual particles. It can even be tweaked to skip clusters that are too far. Detailed explanation.

Build, CI, CD

CI/CD are both in GitHub actions, and automatically deployed to Netlify. The only build process is wasm-pack for Rust to WebAssembly, and Tailwindcss. This lean pipeline is only 1 minute of build time.

About

NBody simulator on a HTML canvas where all calculation are performed via WASM Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published