Skip to content

Got Orbiting Working #1

Description

@EthanWelsh

Alright so I think that I finally got the orbiting behavior to work! Let's try to tackle the graphical component next... In case it is helpful to you, here is a summary on what I've done so far:

'Planet' objects are the primary component of the simulation. Each planet consists of a 'mass', 'origin', and 'heading.' The mass component of a planet is of non-specific units--I have been picking arbitrarily small/large values to test planet/sun configurations-- and is a determining factor in calculating the magnitude of the gravitational pull. The origin of a planet (a coordinate) is where the planet is centrally located. Each 'tic' of the simulation, this origin is adjusted in accordance with the gravitational forces acting upon it. Lastly, planets have a heading vector which has a X and Y component that indicates the speed and direction at which a planet is currently moving.

In order to figure out where to move the planet next, we first next to find the force vectors from the given planet to every other planet in the simulation. The magnitude of these force vectors to another planet are determined using Newton's Universal Gravitational Equation:

screen shot 2014-12-24 at 12 42 57 pm

After the magnitude of the vector has been determined, the magnitude is split proportionally to the vertical and horizontal distance to the given planet. A vector with a magnitude of 10 which points to another planet located 60 steps right and 40 steps down will result in a vector of (6, -4).

After constructing all the force vectors from the planet to every other planet in the simulation, a new heading vector is determined by summing all the force vectors together and adding the existing heading vector. The origin of the planet is moved in accordance with this new heading vector and the process repeats continually.

Henceforth, because we do not yet have any graphical components made, I have been testing the program by printing out the origin of the planet at each step in the simulation and then plotting those points on a graph. I have been using this site: http://www.shodor.org/interactivate/activities/SimplePlot/ Below you can see a picture of the origin plotted across 30 steps in the simulation. A planet, starting at (-10, -15) is orbiting a much heavier 'sun' (planet) located at (0, 0):

screen shot 2014-12-24 at 12 32 29 pm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions