Members - Reputation: 337
Posted 22 August 2001 - 07:03 AM
Members - Reputation: 929
Posted 22 August 2001 - 07:19 AM
Members - Reputation: 864
Posted 26 August 2001 - 08:09 PM
So, if you want to simulate a bunch of planets, asteroids and objects, then you''re going to have to cheat.
What you can do is this.
1) Simulate the orbits of objects using Keplar''s laws. These state that: 1) The path of an orbit of one object around another is an ellipse, where the central object is located at a focus of the ellipse; 2) That the straight line joining the two objects sweeps out equal areas in equal length timesteps; and, 3) that the square of the period of the orbit is proportional to the cube of the average radius of orbit. The average radius is equal to the length of the semi-major axis of the ellipse (which is just half the length of the major (longest) axis of the elipse).
You can use these facts to simulate objects orbiting one another where the mass of one object is significantly larger than the other. Works for planets and asteroids orbiting stars, space ships orbiting planets, stars or large asteroids, etc,...
Now, when you want to figure out how the motion of a space ship is perturbed by the gravitational effect of a bunch of planets, then you need to compute the force applied on the ship by each planet. Each planet exerts a force inversely proportional to the square of the distance between it and the space ship. The actual equation is:
F = GM1M2/R2
G is the Universal Gravitational Constant
M1 is the mass of object one
M2 is the mass of object two
R the distance between them.
Project all forces as acting radially outward (in 3-D space) from the space ship and sum them to find the resultant force. Add to this the force generated by the space ships engines and you have the resultant force for the direction of motion of the ship. From this compute the acceleration and use a suitable integration routine to compute the new position of the space ship given its current position.
At each time step of the integration you will need to update the ships position and that of all of the planets. The computational cost of this method will be directly proportional to the number of celestial objects you are simulation.
Moderators - Reputation: 1158
Posted 29 August 2001 - 06:52 AM
As stated earlier, the force of gravity obeys the following equation:
Centripetal force is governed by this equation:
If we say that the m in the centripetal equation is the same as m1, then we can se these equal to one another like so:
Cancel out the m1''s
Cancel out one of the r''s
And solve for v
This v is a tangential velocity (i.e. it must be perpendicular to the radius between the objects at all times).