Create a program that calculates the next syzygy of four planets:
Assumption: Orbits are circular
Input: text file provided detailing planet, Orbitalradius, Orbital velocity, current position
Parameter Input: within a given error
Period of Interest: 10,000 earth days.
Text file: sysygy.txt
Mercury 36800000 107082 180
Venu 67200000 78337 355
Earth 93000000 66615 0
Mars 141600000 53858 250
I am facing problem to update position of planets after one second? what would be the position of each element after every second in a loop?
Assuming circular orbits and the length units for radius are the same as those implicit in the velocity ...
Angular velocity (in radians per second) is (OrbitalVelocity)/(OrbitalRadius)
So,
angular velocity (in degrees per second) is (180/pi)*(OrbitalVelocity)/(OrbitalRadius).
So, after one second, the "current position" - which appears to be in degrees - will advance for each planet by
(180/pi)*(OrbitalVelocity)/(OrbitalRadius)
Make sure that every time you pass 360 degrees you knock 360 off.
Sysygy (wow, 6 consonants, no vowels!) occurs when all your planets are lined up, so will either have the same angular position, or one differing by 180 degrees.