greenya wrote:CmdKewin wrote:... Real-life relative sizes...
This is impossible to implement. I mean this is impossible to implement to stay project interesting -- it is because indeed:
- planets so far from each other;
- planets very very small relatively to distances;
- the Sun is very big relatively to all other planet sizes; ( for example if we want to get real-life relative -- when the Sun shows on all the screen, Earth will become just a 1 pixel of the screen ( indeed even less then 1 pixel ) );
"Relative" is the key word...

You set up a scale factor, let's say 1.0 and base all your calculations on this number. Here is an example of what we used:
EarthOrbit=1.0;
EarthRotation = EarthOrbit*365.25636;
EarthAOrbit=EarthOrbit; /* Axis Orbit */
EarthARotation=EarthRotation * -0.5; /* Axis Rotation */
SunRotation=EarthRotation/20.0;
MoonOrbit = EarthRotation/27.321582;
MoonRotation = MoonOrbit;
MarsOrbit = EarthOrbit/1.88081578;
MarsRotation=EarthRotation/1.0274907;
MercuryOrbit = EarthOrbit/0.2408445;
MercuryRotation=EarthRotation/58.6462;
...
o_Mars.id=103;
o_Mars.x=0.0f;
o_Mars.y=0.0f;
o_Mars.z=0.0f;
o_Mars.orbit_angle=0.0f;
o_Mars.width=o_Earth.width*0.532;
o_Mars.height=o_Mars.width;
o_Mars.e = 0.0934f;
o_Mars.a = o_Earth.a*1.523691; o_Mars.distance=o_Mars.a*(1-o_Mars.e*o_Mars.e)/(1-o_Mars.e*cos(o_Mars.orbit_angle));
Code: Select all
void MarsSys()
{
GLfloat phi;
//Coordinates
o_Mars.orbit_angle = MarsOrbit * (M_PI/180.0);
o_Mars.distance=o_Mars.a*(1-o_Mars.e*o_Mars.e)/(1-o_Mars.e*cos(o_Mars.orbit_angle));
phi = M_PI/2.0-o_Mars.teta*M_PI/180.0;
o_Mars.x = o_Mars.distance*cos(o_Mars.orbit_angle)*sin(phi);
o_Mars.y = o_Mars.distance*cos(o_Mars.orbit_angle)*cos(phi);
o_Mars.z = -o_Mars.distance*sin(o_Mars.orbit_angle)*sin(phi);
glPushMatrix();
glPushName(o_Mars.id);
glRotated(o_Mars.teta,0.0,0.0,1.0); //inclina il piano orbitale
glRotated(MarsOrbit, 0.0, 1.0, 0.0);
glTranslatef(o_Mars.distance,0.0,0.0);
glPushMatrix();
glRotated(-MarsOrbit, 0.0, 1.0, 0.0); //elimina la rotazione orbitale
glRotated(-25.19, 0.0, 0.0, 1.0); //inclina l'asse di rotazione
glRotated(MarsRotation, 0.0, 1.0, 0.0);
if(show_orbits==1) //disegna gli assi
{
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glColor3f(1.0,0.0,1.0);
glBegin(GL_LINES);
glVertex3f(0, -1, 0);
glVertex3f(0, 1, 0);
glEnd();
glBegin(GL_LINES);
glVertex3f(-1, 0, 0);
glVertex3f(1, 0, 0);
glEnd();
glEnable(GL_TEXTURE_2D);
glEnable(GL_LIGHTING);
}
glRotated(-90.0,1.0,.0,0.0);
glBindTexture(GL_TEXTURE_2D, texture[6].texID);
gluSphere(quadratic,o_Mars.width,50,50);
glPopMatrix();
glPopName();
glPopMatrix();
}
void MercurySys()
{
GLfloat phi;
//Coordinates
o_Mercury.orbit_angle = MercuryOrbit * (M_PI/180.0);
o_Mercury.distance=o_Mercury.a*(1-o_Mercury.e*o_Mercury.e)/(1-o_Mercury.e*cos(o_Mercury.orbit_angle));
phi = M_PI/2.0-o_Mercury.teta*M_PI/180.0;
o_Mercury.x = o_Mercury.distance*cos(o_Mercury.orbit_angle)*sin(phi);
o_Mercury.y = o_Mercury.distance*cos(o_Mercury.orbit_angle)*cos(phi);
o_Mercury.z = -o_Mercury.distance*sin(o_Mercury.orbit_angle)*sin(phi);
glPushMatrix();
glPushName(o_Mercury.id);
glRotated(o_Mercury.teta,0.0,0.0,1.0); //inclina il piano orbitale
glRotated(MercuryOrbit, 0.0, 1.0, 0.0);
glTranslatef(o_Mercury.distance,0.0,0.0);
glPushMatrix();
glRotated(-MercuryOrbit, 0.0, 1.0, 0.0); //elimina la rotazione orbitale
glRotated(-0.1, 0.0, 0.0, 1.0); //inclina l'asse di rotazione
glRotated(MercuryRotation, 0.0, 1.0, 0.0);
if(show_orbits==1) //disegna gli assi
{
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glColor3f(1.0,0.0,1.0);
glBegin(GL_LINES);
glVertex3f(0, -1, 0);
glVertex3f(0, 1, 0);
glEnd();
glBegin(GL_LINES);
glVertex3f(-1, 0, 0);
glVertex3f(1, 0, 0);
glEnd();
glEnable(GL_TEXTURE_2D);
glEnable(GL_LIGHTING);
}
glRotated(-90.0,1.0,.0,0.0);
glBindTexture(GL_TEXTURE_2D, texture[9].texID);
gluSphere(quadratic,o_Mercury.width,50,50);
glPopMatrix();
glPopName();
glPopMatrix();
}
And so on.

Get the idea? That data is based on actual values, you can find them in any Physics Formulary.
As you can see from the below image, results are acceptable.
greenya wrote:
that is why only planet order ( from Sun to Pluto is real ) , and relative size between planets real in some meaning ( i mean if Jupiter bigger than Earth -- it is very easy to determinate, BUT you will never guess by your eyes that Jupiter is 15 times bigger of Earth ).
Tell that to the Celestia guys
p.s. If you want an executable, PM me. You can see for yourself

p.s.s: Yes, we ARE crazy. Guess than having the best grade possible in 3D Graphics is more than satisfactory
