Double Pendulum Simulation using C++20 and SFML
This Project has been made solely for the purpose of learning more about SFML and C++20 and simulations. The integrator used is a modified version of Velocity Verlet where acceleration also depends on velocity see here. The UI has been made using Dear ImGui and ImGui-SFML for sfml bindings of imgui.
CLI - interface to provide initial conditions for the pendulumCLI support has been removed completely.No GUI support for manipulation of the paramentersFear not Dear, ImGui is here ;)Uses RK4 integratorUses modified Velocity Verlet
- Add options to allow damping effect
- Mulitple pendulums
- Anchor points to grab the pendulum in the UI itself
- Feel free to open a PR for more
P.S.-
I am extremely new to C++ build sytems and it is a nightmare to deal with,I have come a long way since the first time I made this so I am somewhat more comfortable and confident now in building C++ projects however cross IDE CMake scripts are still not my cup of tea so if the CMake scripts don't work for your end please raise an issue and if you find any solution to mitigate the above create a PR.
After cloning the project, make sure to initialize the submodules too.
$ git clone --recursive <REPO_LINK>
If project is already cloned
$ git submodule update --init --recursive
-
C++ compiler which supports
C++20 and above
: Check your compiler version, if it has support for c++20. -
CMake >= 3.21
: Check if you have CMake installed by running$ cmake --version
If it is not available then install CMake from here depending on your OS.
If you are on Linux, you can use the one provided by your package managers.
-
Create a
build
directory in current project directory$ mkdir build
-
Generate build files in the
build
directory$ cmake -S . -B build
-
- For a Release build:
$ cmake --build build --config Release
- For a Debug build:
$ cmake --build build --config Debug
This will build for the default builder you have [Makefile or Ninja or MSVS etc]. You could specify a builder by adding a -G flag, for example to create build files for Ninja:
$ cmake -G "Ninja" -S . -B build/[Debug/Release]
-
Navigate to
build
and run the executable$ cd build $ ./DoublePendulum (Linux) ./DoublePendulum.exe(Windows)
If you like this project be sure to star it :)