
Solving interesting problems and implementing them in C++ is a good way to learn the C++ language.
In this course, we understand the Physics and theory behind the motion of the Ball falling under gravity. We understand the equations for velocity and displacement of the ball at different intervals of time. Then we programmatically sample the time and render the position of the ball, calculated using above equations.
We use SDL graphics library to visualize the simulation.
Structure of the course:
1. Theory and Physics behind Ball fall and bounce under gravity
2. Program to calculate velocity and displacement of the ball
3. SDL graphics programming in C++
4. Final simulation program in C++
Different C++ & programming concepts used during software development:
classes, public & private variables, functions, constructors, compilation and running with g++, SDL graphics library (-lSDL2)
SDL graphics functions used: SDL_CreateWindow, SDL_CreateRenderer, SDL_SetRenderDrawColor, SDL_RenderClear, SDL_RenderPresent, etc. draw circle using 'midpoint circle algorithm'.
Future enhancements Possible: Multiple balls falling under gravity using multiple threads in C++, option to change the gravity to simulate different planets, Ball falling at an angle.
Applications of simulation: educational tool to learn physics or mathematics concepts visually, Product design or engineering R&D in aerodynamic, fluid dynamics, etc.