Simulate the forming of a galaxy (v2.0)

Developed by Henrik Somogyi, 2022

                           

                planets (bodies in universe).

Your browser does not support the HTML 5 Canvas

Users Guide

This is an animation of the motion of objects in a 2D universum.

Each object (one can name them suns, planets, asteroids) attracts each other by the classical gravitational law. When two objects get too close, then they collide, get merged, while the conservation of momentum is maintained. Upon such a merge, the new object's mass becomes the sum of the two masses, and its color becomes the "average" of two colors. You can set the number of objects in the input field. You browser and PC speed may limit this to some humdreds.

The initial objects' speeds and location is random (uniform distributions). When friction is on, then each object loses a proportional part of its motion energy by time (moving thru some galactical fog).

When "Boxing" is on, objects bounce back from the border of the rectangle of observation. This is not realistic, but makes the detection of emerging solar-systems more likely.

Mouse click: sets the center-of-screen to the selected location. And the object that is the nearest to this selected location gets the focus. The visible size of objects is proportional to the mass (radius of 3D sphere), but independent of the zoom level: in order to keep objects visible even when zoomed out very much.

By activating the "Test" mode (button "Test") a simple 1-Sun+1-Earth+1-Moon solar system is animated. Here you can watch how these objects move. You can decrease their speeds by the button "Speed-" and watch how the Moon crashes into the Earth or into the Sun. And, how the Earth crashes into the Sun - or just moves to a closer orbit. By increasing their speed by button "Speed+", you can see how the Moon escapes from the Earth and Sun, or how the Earth escapes from the Sun, - or just gets into a farther orbit.

Total sum of motion energy is displayed. Friction on/off, Boxing on/off as well.

Watch how solar systems (one or more object(s) orbiting another one) get formed or dissolve, or collide. This is not too frequent, you may need patience.


Button "Speed-" : when pressed, each object loses a fix percentage from its motion energy.
Button "Speed+" : when pressed, each object gains a fix percentage to its motion energy.
Button "Reset" : when pressed, each object gets to a random start position, with a random speed.
Button "Friction" : toggles if "galactical" friction is on or off.
Button "Explode" : the object in focus (with the cross-hair) explodes into 3 new objects. Mass and momentum stay conserved.
Button "Lock" : the coordinate system is positioned to the object in focus (with the cross-hair): location and actual speed.
Button "Trace" : the objects' trajectory is painted as they move.
Button "Test" : A simple solar system is started.
Button "Zoom-" : Zoom out
Button "Zoom+" : Zoom in
Button "Boxing" : Objects bounce back at the border of the rectangle of observation (screen)
Mouse click: sets the center-of-screen to the selected location. And the object that is the nearest to this selected location gets the focus.