Skip to content

Commit

Permalink
Modified README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
RougherO committed Sep 10, 2023
1 parent 71093f0 commit 39d8fe7
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/
.vscode/
.vscode/
config/
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.21.0)
project(DoublePendulum VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)

include(FetchContent)
FetchContent_Declare(
Expand All @@ -11,7 +12,6 @@ FetchContent_Declare(
FetchContent_MakeAvailable(SFML)

add_executable(DoublePendulum "src/main.cpp" "src/App/App.cpp" "src/DoublePendulum/DPendulum.cpp")
target_compile_options(DoublePendulum PRIVATE cxx_std_20)
target_link_libraries(DoublePendulum PRIVATE sfml-graphics sfml-window sfml-system)

if (WIN32)
Expand Down
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,66 @@
# Double-Pendulum
Double Pendulum Simulation using C++20 and SFML

### Description
This Project has been made solely for the purpose of learning more about SFML and C++20 and simulations. Although it implements C++20, lot of the code and syntax still use older C++ styles like raw pointers. In future releases, the code will be gradually updated to more modern C++ style and syntax and also to SFML-3.0.

Currently there is no on screen gui for manipulating the pendulums' length and mass or changing gravity and more fun stuff, you can still do it from the code, however in future you can expect support for that with ImGUI-SFML.

The integrator used in the simulation is Runge-Kutta 4th order which is not very stable so the simulation gradually loses energy with time with the added cost of being compute intensive. This shall also be modified and replaced with Verlet integration which is more stable.

P.S.- I am extremely new to C++ build sytems and it is a nightmare to deal with so if the CMake scripts don't work for your end please raise an issue and if you found any solution to mitigate the above create a pull request, shall try to review and merge it as soon as possible.

### Requirements
1. `g++ version >= 10`:

Check your compiler version by running
```bash
$ g++ --version
```
in your terminal, in case you have older compiler you will need a new one to compile this project.
2. `cmake >= 3.21`:

Check if you have Cmake installed by running
```bash
$ cmake --version
```
If it is not available then install CMake from [here](https://cmake.org/download/ "Download CMake here") depending on your OS. Add it to your PATH environment variable.
3. `SFML = 2.6.x`:

The provided CMakeLists.txt by default installs SFML for you using `FetchContent()` in the build directory you provide and links them to the executable. If you already have SFML installed with version 2.6 in standard path then you can disable this behaviour and cmake will do the rest
4. `Ninja`:

Check if you have Ninja installed by running
```bash
$ ninja --version
```
If it is not available then install Ninja from [here](https://github.com/ninja-build/ninja/releases "Download Ninja here") depending on your OS. Add it to your PATH environment variable.

### How to install
1. Create a `build` directory in current directory and then create a Debug and Release directoy under it.

```bash
$ mkdir build/Debug && mkdir build/Release
```
Select Debug or Release build:

2. For a Release build:

```cmake
$ cmake -G "Ninja" -S . -B build/Release
$ cmake --build build/Release --config Release
```
3. For a Debug build:

```cmake
$ cmake -G "Ninja" -S . -B build/Debug
$ cmake --build build/Release --config Debug
```
4. Navigate to `build/Debug` or `build/Release` and run the executable

```bash
$ cd build/Release[Debug]
$ ./DoublePendulum (Linux) ./DoublePendulum.exe(Windows)
```
That's it!
_If you like this project be sure to star it_ :)

0 comments on commit 39d8fe7

Please sign in to comment.