The Barnes-Hut simulation is an efficient algorithm for approximating N-body problems, reducing the computational complexity from O(n²) to O(n log n). This implementation, written entirely in Rust, showcases the power and performance of this approach.
- Efficient N-body Simulation: Utilizes the Barnes-Hut algorithm for fast approximation of gravitational interactions.
- Rust Implementation: Leverages Rust's performance and safety features for robust and efficient code.
- Interactive Visualization: Provides a real-time visual representation of the simulation.
- Customizable Parameters: Allows users to adjust simulation parameters for different scenarios.
Click the image above to watch the simulation in action!
- Ensure you have Rust installed on your system.
- Clone this repository:
git clone https://github.com/yourusername/barnes-hut-simulation.git cd barnes-hut-simulation
- Run the simulation:
cargo run --bin draw_quadtree --release
P: Pause/Unpause the simulation
Spacebar: Toggle tree visualization
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
- Josh Barnes and Piet Hut for their groundbreaking work on the Barnes-Hut algorithm.
- The Rust community for their excellent documentation and support.