Selected Mathematical Actionscript functions used:
function beta( P, A, epsilon ) {
A*= scalefactor;
gbeta1 = 2*Math.PI*t/P;
gbetaV = gbeta1;
while (Math.abs(gbetaV - (gbeta1 + epsilon*Math.sin(gbetaV)))>=.0000001)
{
gbetaV = gbeta1 + epsilon*Math.sin(gbetaV);
}
r = (A*(1 - epsilon*Math.cos(gbetaV)));
alpha = 2*Math.atan(Math.sqrt((1+epsilon)/(1-epsilon))*Math.tan(gbetaV/2));
}
function coord() {
if (alpha <= Math.PI/2 && alpha > 0) {
dY= - Math.sin(alpha)*r;
dX= Math.sqrt((r*r)-(dY*dY));
} else if (alpha > Math.PI/2 && alpha <= Math.PI)
{
dY= - Math.sin(Math.PI - alpha)*r;
dX= -Math.sqrt((r*r)-(dY*dY));
} else if (- alpha > Math.PI/2 && - alpha <=
Math.PI) {
dY= Math.sin(Math.PI + alpha)*r;
dX= - Math.sqrt((r*r)-(dY*dY));
} else if (- alpha <= Math.PI/2 && - alpha >
0) {
dY= Math.sin(- alpha)*r;
dX= Math.sqrt((r*r)-(dY*dY));
}
}
function setup_planets() {
solar_system = new Array();
planets = new Array();
trails = new Array();
with(planets) {
push(mercury=new planet( "Mercury",
.3871, .3871, .2056, mercury_graphic, 0xE8BE86 )); //color
push(venus=new planet( "Venus",
.7233, .7233, .0068, venus_graphic, 0xE2592C )); //color
push(earth=new planet( "Earth",
1, 1, .0167, earth_graphic, 0x00CCFF )); //color
push(mars=new planet( "Mars",
1.5327, 1.5237, .0934, mars_graphic, 0xFF0000 )); //color
push(jupiter=new planet( "Jupiter",
5.2028, 5.2028, .0484, jupiter_graphic, 0xE8BE86 ));
push(saturn=new planet( "Saturn",
9.5039, 9.5039, .0557, saturn_graphic, 0xFF8000 ));
push(uranus=new planet( "Uranus",
19.182, 19.182, .047, uranus_graphic, 0xFFFFFF ));
push(neptune=new planet( "Neptune",
30.058, 30.058, .009, neptune_graphic, 0x6294E3 ));
push(pluto=new planet( "Pluto",
39.44, 39.44, .25, pluto_graphic, 0x33FF99 ));
push(user=new planet("", .3531,
35.71, .8, userplanet_graphic, 0xFFFF00 ));
}
reset_planets(0, planets.length-1);
}