2D visualization of Blackhole
Introduction
I created this project to simulate the behavior of space-time, blackhole and gravity using C++ with SFML
Theory
A blackhole is massive, its mass is equal to 2.6 billion solar masses, or 2.6 billion suns.
It's so massive that we can’t see it because the gravitational pull is so strong, there is so much matter in there that any light that is traveling towards it,
once it in certain proximity can no longer escape it. This proximity is called the event horizon.
The radius of a blackhole, or the distance between the center of the blackhole and the event horizon is called the Schwarzschild radius.
Schwarzschild radius is 2 * the universal gravitational constant (G) * mass of the blackhole(M) / square(c) where c is the speed of light.
The accretion disk is all the matter that is orbiting the black hole. Its 3 times the Schwarzschild radius.
At 1.5 times the Schwarzschild radius is where the light will orbit is where the photons orbits.
So when light hits the blackhole (travel towards the blackhole), they temporarily bend around the photon orbit and then either spiral in and die in the blackhole
or they spiral out and just go out.
So the question is, are they bending? Or are they simply traveling in a straight line through the curve of space-time?
So now we can think about why the space-time bends around a supermassive object.
This project is clearly out of the scope of the Theory of relativity.
This is just simulating the behavior of photons (beams of light), and other matter and how they might behave in the presence of a black hole.
We have the following cases here:
If it is traveling towards the blackhole, all particles, including light should get sucked-in by the blackhole.
If outside the photon orbit, ie the grey area or the accretion disk, the matter orbits, the light particles bends.
If inside the red area(photon orbit), matter objects get absorbed and die, this is event horizon past which nothing can escape.
In the red area (photon orbit) only light can orbit as light has no mass, but in the grey area (accretion disk), the matter can also orbit.
The photon sphere is an unstable orbit, ie eventually all the light particles will either fall in the black hole or spiral out and head off to infinity.
Working Theory
1. Simulated the behavior of light particles, gravity & other matter around the Schwarzschild blackhole using C++ & SFML.
2. Created objects using SFML Texture and Sprites.
3. The orbiting behavior of the physical matter is simulated by programming the circular motion with angular speed, radial acceleration and the angle of rotation.
4. The angle of rotation is incremented by the speed of the object. At every frame, the x and y coordinates are calculated as sine and cosine of the angle of rotation.
5. Simulated the gravitational-pull by programming a Spaghettification or “noodle effect” of planets and other heavy bodies. This is achieved by increasing the movement and the width and decreasing the height of the Sprites at the same time.
