- #1
Rapidrain
- 31
- 0
I have been toying with a java programming project for a few months now. I want to
depict a satelite orbiting a planet (2 dimensional).
I've scaled down certain constants to fit the screen and have put GM (mu) at 200000 and
the distance from the gravitaional body, a planet, at 200 (pixels). Using the equations
where a perfect orbital velocity is equal to sqrt(GM/dist), I must have a velocity of
sqrt(1000) 31.62 pixels/sec to remain in a circle.
Problem is my model depicts an ellipse.
The distance starts at 200, drops down to nearly 150 halfway around and climbs up again
(!) to 200 when it reaches the starting point. This is better than crashing into the
planet or flying away in a straight line...but still it should be a "perfect" circle.
I could understand it if my crude iteration method made a consistently "too small" or
"too big" quantity and cause the satellite to slowly spiral into the planet and crash or
caused the satellite to slowly spiral away from the planet. However the satellite
creeps down and then creeps up in a single orbit. Very strange. Why the wobble?
Yes, I am moving in singular one second steps around the planet and complete the orbit
in about 24 steps. And yes, if I took infinitely small steps an infinite number of
times, instead of a finite number of iterations, then I would come out with a perfect
circle. I am not Isaac Newton though.
Can I compensate in any way? Multiply the vector magnitude by sqrt(1/pi) or something
like that? Tilt the initial velocity vector away from the planet by 1/distance degree or
something?
depict a satelite orbiting a planet (2 dimensional).
I've scaled down certain constants to fit the screen and have put GM (mu) at 200000 and
the distance from the gravitaional body, a planet, at 200 (pixels). Using the equations
where a perfect orbital velocity is equal to sqrt(GM/dist), I must have a velocity of
sqrt(1000) 31.62 pixels/sec to remain in a circle.
Problem is my model depicts an ellipse.
The distance starts at 200, drops down to nearly 150 halfway around and climbs up again
(!) to 200 when it reaches the starting point. This is better than crashing into the
planet or flying away in a straight line...but still it should be a "perfect" circle.
I could understand it if my crude iteration method made a consistently "too small" or
"too big" quantity and cause the satellite to slowly spiral into the planet and crash or
caused the satellite to slowly spiral away from the planet. However the satellite
creeps down and then creeps up in a single orbit. Very strange. Why the wobble?
Yes, I am moving in singular one second steps around the planet and complete the orbit
in about 24 steps. And yes, if I took infinitely small steps an infinite number of
times, instead of a finite number of iterations, then I would come out with a perfect
circle. I am not Isaac Newton though.
Can I compensate in any way? Multiply the vector magnitude by sqrt(1/pi) or something
like that? Tilt the initial velocity vector away from the planet by 1/distance degree or
something?