WARNING: This library's architecture suffers from significant design limitations and necessitates a comprehensive overhaul.
Just a simple physics simulation engine with visualization using ffmpeg.
It is also part of the project assignment for the course "Math Software" at ZJU in 2025.
- Basic model
- Verlet algorithm
- visualization using OpenCV
- GUI
Some C++20 features like format and concept is used in this project, so make sure you have a C++20 compatible
compiler. The project has been tested with GCC 15 and MSVC 19.43.34809. It should work with GCC 13 and later versions as
well.
We use the following libraries:
- OpenCV - For image processing and visualization
- Boost - For various utilities
- GTest - For unit testing (Only if
PHOSPHORUS_BUILD_TESTSis enabled) - range-v3 - For range-based algorithms. It is also included in the project.
Besides, gnuplot is required for visualization, but is not as a library dependency. Please make sure that gnuplot is
in your PATH environment variable.
NOTE: We use boost.process to handle subprocesses, but it is not installed on ubuntu by default, even
if libboost-all-dev package is installed. It would be better to manually install boost.process.
We use CMake to build the project. You can build it using the following commands:
mkdir build
cd build
cmake .. -G Ninja
cmake --build . -j${nproc}Also, there are some options listed below:
PHOSPHORUS_BUILD_TESTS- Build the tests (default:ON, requiresgtest)PHOSPHORUS_BUILD_EXAMPLE- Build the example (default:ON)
Besides, we provide a Makefile to automatically call CMake and build the project.
src/- Source codeinclude/- Header filestest/- Unit tests usinggtestexample/- Example usage and demoTask1.cpp- Example for Task 1: spring simulationTask2-1.cpp- Example for Task 2-1: Sun and Earth simulationTask2-2.cpp- Example for Task 2-2: Sun and Earth simulation with initial velocityTask3.cpp- Example for Task 3: three-body problem simulation