DanThaiWang

2011-Feb-04, 01:30 PM

Hello,

Thanks for stopping by.

I'm a web developer with a keen interest in Astronomy. I've been working on an Orbiter application using Flash Actionscript 3.0 (since this is my native language to use). Please have a look here :

http://danthaiwang.wordpress.com/2010/11/05/pldm-orbiter/

It's very early in development, as is pretty obvious I think.

I have managed to create lots of pretty patterns resembling the Spirograph toy I remember as a kid but when I try to make a uniform collection of bodies orbiting a single larger massive object I get a little stuck.

For example the inner bodies I added close to the massive object (let's call it The Sun from now on) orbit nicely and continuously without any problems. I seem to, however, hit a bit of a wall when I get to a certain area away from The Sun. Please see the picture below :

http://www.pldm.co.uk/orbiter/download/orbitDemo.jpg

Apologies, it's a bit of a mess. Now, inner most you see a small dot, this is The Sun. Next you have an orbit of a much smaller body and outside that a blue orbit of similar size. Let's call these Venus and Earth for now (sorry Mercury).

I add these bodies to the environment by giving them a mass, a starting xPosition, starting yPosition, xVelocity and yVelocity.

Now then, it seemed to me the most logical way of doing this is by giving The Sun the starting position of x:0 and y:0. For the sake of the test I gave it a mass of 500.

Venus, the closest planet in this system, has a mass of 6, starting x:-750 and a y:0. So, this means that when she starts off I only need to give her a y-Velocity, since she's in line with The Sun, she can only go upwards in order to be pulled around. So, after a bit of trial and error I figured out that a start y-Velocity of -56 (these are actually pixels per frame) swings her around and produces a more-or-less circular obit. Nice.

Earth has a mass of 6.25, starting x:-3000, y:0, x-Vel:0, y-Vel:-50. This also brings it around into a nice circular orbit. Not perfectly but nothing's perfect so that's good enough for me.

Mars... that pesky little planet, is where I run into problems. As you can see by the diagram I can't find the perfect y-Velocity to get it going in a circular orbit. The most it manages at any time is about 1.5 orbits before either diving into the centre or flying off into the wilderness. Here are it's attributes :

Mass : 2.5

radius : 4

x : -5000;

y:0;

x-Vel : 0

y-Vel : Varies, see diagram.

On top of this, I find that I can keep splitting the velocity down to 6 or 7 decimal points and it still goes either inwards in a death spiral or outwards to oblivion.

My question is this :

Am I struggling to nail these outer orbits for any of the following reasons, or a combination of all of them.

1. Actionscript simply can't support the number of decimal points required to get an accurate starting velocity. This could be a rounding issue.

2. I haven't taken into consideration the rotation of The Sun and the extra momentum this would give these bodies in real life. If this is the case, why do the inner planets work fine?

3. Anything to do with me just using pseudo figures pseudo units? I figured although it's not accurate figures, it's using the basic rules of physics which seems to work closer to the sun.

Sorry it's such an open question. I can imagine it's quite a nightmare one to have to deal with. Anyway, if you follow the link to the app at the top of this thread, there's a download link where you can play with the starting values and add/remove planets.

Thanks in advance.

Thanks for stopping by.

I'm a web developer with a keen interest in Astronomy. I've been working on an Orbiter application using Flash Actionscript 3.0 (since this is my native language to use). Please have a look here :

http://danthaiwang.wordpress.com/2010/11/05/pldm-orbiter/

It's very early in development, as is pretty obvious I think.

I have managed to create lots of pretty patterns resembling the Spirograph toy I remember as a kid but when I try to make a uniform collection of bodies orbiting a single larger massive object I get a little stuck.

For example the inner bodies I added close to the massive object (let's call it The Sun from now on) orbit nicely and continuously without any problems. I seem to, however, hit a bit of a wall when I get to a certain area away from The Sun. Please see the picture below :

http://www.pldm.co.uk/orbiter/download/orbitDemo.jpg

Apologies, it's a bit of a mess. Now, inner most you see a small dot, this is The Sun. Next you have an orbit of a much smaller body and outside that a blue orbit of similar size. Let's call these Venus and Earth for now (sorry Mercury).

I add these bodies to the environment by giving them a mass, a starting xPosition, starting yPosition, xVelocity and yVelocity.

Now then, it seemed to me the most logical way of doing this is by giving The Sun the starting position of x:0 and y:0. For the sake of the test I gave it a mass of 500.

Venus, the closest planet in this system, has a mass of 6, starting x:-750 and a y:0. So, this means that when she starts off I only need to give her a y-Velocity, since she's in line with The Sun, she can only go upwards in order to be pulled around. So, after a bit of trial and error I figured out that a start y-Velocity of -56 (these are actually pixels per frame) swings her around and produces a more-or-less circular obit. Nice.

Earth has a mass of 6.25, starting x:-3000, y:0, x-Vel:0, y-Vel:-50. This also brings it around into a nice circular orbit. Not perfectly but nothing's perfect so that's good enough for me.

Mars... that pesky little planet, is where I run into problems. As you can see by the diagram I can't find the perfect y-Velocity to get it going in a circular orbit. The most it manages at any time is about 1.5 orbits before either diving into the centre or flying off into the wilderness. Here are it's attributes :

Mass : 2.5

radius : 4

x : -5000;

y:0;

x-Vel : 0

y-Vel : Varies, see diagram.

On top of this, I find that I can keep splitting the velocity down to 6 or 7 decimal points and it still goes either inwards in a death spiral or outwards to oblivion.

My question is this :

Am I struggling to nail these outer orbits for any of the following reasons, or a combination of all of them.

1. Actionscript simply can't support the number of decimal points required to get an accurate starting velocity. This could be a rounding issue.

2. I haven't taken into consideration the rotation of The Sun and the extra momentum this would give these bodies in real life. If this is the case, why do the inner planets work fine?

3. Anything to do with me just using pseudo figures pseudo units? I figured although it's not accurate figures, it's using the basic rules of physics which seems to work closer to the sun.

Sorry it's such an open question. I can imagine it's quite a nightmare one to have to deal with. Anyway, if you follow the link to the app at the top of this thread, there's a download link where you can play with the starting values and add/remove planets.

Thanks in advance.