Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

One day someone asked me to write a program for modeling the Solar System. Using the capabilities of the modern Internet, I did it.

License

Notifications You must be signed in to change notification settings

Alimektor/solar-system-model-cpp-clr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solar System Model in C++/CLR (Windows Forms Visual C++)

One day someone asked me to write a program for modeling the Solar System. Using the capabilities of the modern Internet, I did it.

Description

Task: object-oriented programming of an astronomical model of the Solar System. The model represents the Sun and the planets Mercury, Venus, Earth, Mars and their satellites.

The program works as described below:

  • The screen shows the Sun and the planets with their satellites. They are placed around the Sun at their astronomical positions.
  • The planets begin to rotate around the Sun on their orbits with the correct ratio of velocities. At the same time, the satellites begin to rotate around their planets along trajectories consisting of two rotational motions: the rotation of the planet around the Sun and the rotation of the satellite around the planet.
  • To generalize the definitions of different celestial bodies, define the TBody object.
  • Planets and satellites, just like the Sun, are celestial bodies. They should be defined as heir objects to the `TBody' object.
  • Heir objects must contain fields:
    • 1. the current coordinates of the celestial body;
    • 2. the center around which the body rotates;
    • 3. the orbital radius;
    • 4. the satellite list;
    • 5. the rotation speed;
    • 6. the size of the celestial body;
    • 7. the color of the celestial body.
  • The rotation of both planets and satellites around the central body follows the same rules of nature.
  • The sun is to the planets the body around which they revolve, some planet is also to each satellite. This motion for all celestial bodies can be determined by one method - rotate().
  • The idea of the method is to make body movements by building up angular movement in increments of 10 degrees.
  • The displacement of each celestial body is calculated as a relative value depending on the value of its speed.
  • Each time the angle is changed, the new coordinates of the body position are calculated.
  • Each planet, having begun to rotate, must launch an appropriate rotation method for its satellites.
  • Relative parameters for planets and satellites are:
Title Radius Speed Size
Mercury 58 0.416 3
Venus 108 0.416 5
Earth 150 0.1 6
Mars 228 0.053 4
Moon 15 1.3 2
Phobos 7 114.4 1
Deimos 12 30.4 1

Yes, a lot of things are described here are very complicated, but in fact, the main thing here is to understand the meaning of the table.

Demonstration

General Demonstration of the Program

General demonstration

Start/Stop Animation Operation

Start/Stop Animation

Changing the Size Coefficient of Celestial Bodies

Size Change

Changing the Radius Coefficient of Celestial Bodies

Radius Change

License

MIT

About

One day someone asked me to write a program for modeling the Solar System. Using the capabilities of the modern Internet, I did it.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages