Disclaimer: I am completely new to rust. This is likely not very "idiomatic". Be kind
This is a dirty mockup of an engine for displaying network graphs with physics applied to the nodes.
This is largely inspired by the barnes hut model from vis.js, particularly the physics based barnes hut models. I did not implement the barnes hut algorithm in any form, but rather implemented the following physics forces to achieve a similar effect:
- Central gravity
- Gravity between nodes
- Repulsion between nodes
- Spring tension
- Left click and drag nodes to move them
- Left click and drag the background to pan
- Use the scroll wheel to zoom and pan
- Press escape to exit
For windows: I've included the SDL2 DLL within the debug and release target folders, but you will need to follow the rest of the associated steps provided in the Rust-SDL2 Readme. In short:
- Download
SDL2-devel-2.x.x-VC.zip
- Copy the lib files from
{extracted}/lib/x64/
to%userprofile%\.rustup\toolchains\{current toolchain}\lib\rustlib\{current toolchain}\lib
For Linux/MacOS: Just follow the simple instructions in the readme
- Implement minimum force, and consider bodies under limit at rest - To remove jitter
- Implement spatial grid properly, and launch a thread per cell to calculate forces for those circles
- Only apply forces between close cells - to an extent that we perform minimal calculations, but not to the extent that things float away from eachother (Central gravity should solve this)