An open-source simulator electric charges and electric fields constrained within a 2-dimensional plane
This project is intended to get a more intuitive grasp of electrostatics, especially the concepts that would be covered in a undergrad course on computer science. No complicated algorithms have been used, the project works completely based on calculating forces and displacements over very small timesteps.
- Install the SDL2 library
- Use CMake to build the project and run the executable
cmake -B build
cmake --build build
- The only argument is the path to the JSON file to parse for input.
- If no argument is given, the
examples/simple.json
is loaded. - Use UP and DOWN arrow keys to zoom in and out, and W-A-S-D to move the camera around
- Refer the JSON files in the
examples/
folder for information on writing custom configurations.
- SDL2 for graphics and windows excluding UI https://github.com/libsdl-org/SDL
- cJSON for loading configs from files https://github.com/DaveGamble/cJSON
- sdl2-cmake-modules, for easy loading of SDL2 libraries https://gitlab.com/aminosbh/sdl2-cmake-modules
- SDL_FontCache for text rendering https://github.com/grimfang4/SDL_FontCache
- VT323 Font by Peter Hull (obtained from Google Fonts) https://fonts.google.com/specimen/VT323
All forms of contributions are welcomed!