B4J Tutorial B4X Turtle - Planet Orbits

Very very rough (and code not optimized at all)....planets in orbit around the sun:
1. Assumed all orbits are circular
2. Have not scaled the orbits (else I will run out of UI space)
3. Have not scaled the sun and the planets
4. When starting all planets will be aligned "due south"
5. Every "tick" event of the timer moves the planets by the angle that they will move in 24 hours (based on the approx number of days for each planet to orbit 360 degrees around the sun)

I have added "Pluto" as well (9th "rock" from the sun")

It gives a fair idea of how the planets move around the sun relative to one another.....



orbits.png
 

Attachments

  • TurtelPlanets.zip
    70.2 KB · Views: 348

Johan Schoeman

Expert
Licensed User
Longtime User
An improvement - the planets' starting positions are as what they should be (more or less - from literature) on 1 January 2021. Every tick of the timer then represents 24 hours and the planet positions are updated accordingly. The label (top left) indicates the change in date as what the timer ticks. Change the timer's tick "time" to speed it up or slow it down (a tick represents 24 hours)

The calculation of planet positions are far better than that of the project in post #1


planets.gif
 

Attachments

  • 1609677824639.png
    1609677824639.png
    238.9 KB · Views: 238
  • TurtelPlanets.zip
    70.5 KB · Views: 235
Top