# 3D orbits

I am making a three dimentional planetary orbit simulator but I cant figure out a formula that can work out where a certain planet is at a certain time e.g. if a planet with speed s was at position a with the sun at position b at time 0 then how would I calculate the position of the planet at time 1? bearing in mind that the orbits are perfectly circular but may be tilted.

Last edited:

There are two possible ways to interpret your question...

1. What is the equation of a circlualr curve in R^3? (math)

2. How can I get the equation for the trajectory of an object rotating around the sun? (physics)

The first question seems to me to be more like what you're asking... and as such, I would suggest you use parametric equations, which is exactly what it seems like you need (since you are making the planet's position a function of time).

So, say you wanted an orbit that was in a flat circle around the sun... say in the x-y plane. Well, you already know the answer: x = R cos(t), y = R sin(t), z = 0.

If you wanted it in the x-z plane, it could be something like: x = R cos(t), y = 0, z = R sin(t).

Finally, if you want it to be somewhere in between, we can make an educated guess:
x = R cos(t), y = R sin(t) cos (theta), z = R sin(t) sin (theta), where theta is measured with respect to the positive y axis. We see that |<x,y,z>| = R^2 and it works in the limits theta = 0 and theta = pi/2.

2. As far as the physics is concerned, you can either model the set of differential equations a la numerical analysis, or you can just use physics to get the parameters for the above method.

Anyway, hopefully this wasn't a complete misunderstanding of your problem. Best of luck,

- csprof2000

HallsofIvy
Homework Helper
More generally, an "orbit" can be any conic section- a circle, ellipse, hyperbola, or parabola with the sun at one focus. Of course, a straight line through the sun is also possible.

D H
Staff Emeritus
What you are after is what are called orbital elements. A google search for that term will yield a lot of hits. Planet orbits are (nearly) elliptical with the Sun at one of the foci of the ellipse. I'll split this discussion into two parts: The nature of the orbit, and the orientation of the orbit with respect to some reference system.

Two parameters are needed to describe the size and shape of the orbital ellipse. Typically, these are the "semi-major axis length" and the "eccentricity" of the orbit. The eccentricity describes how squashed the ellipse is. The major axis length is the length from one end of the ellipse to the other along the line defined by the foci of the ellipse. The semi-major axis length is simply half of the major axis length.

The planet moves along the orbit according to Kepler's third law (google that). At any point in time, the location of the planet on the orbit can be described by one angular parameter. The most obvious is the "true anomaly" angle between the line segment extending from the Sun to the point at which the planet is closest to the Sun (the perihelion point) and the line segment extending from the Sun to the planet's location at some specific point in time. Others are the eccentric anomaly and the mean anomaly; you will need to understand these (google Kepler's equation) to propagate the orbit in time.

Now for the orientation. Two parameters are needed to describe the plane in which a planet orbits: inclination and "right ascension of ascending node". The inclination is the dihedral angle between the orbital plane and some reference plane. The "right ascension of ascending node", the angle on the reference plane between some reference line and the line defined by the intersection of the two planes (the "line of nodes"). There is an ambiguity of 180 degrees in this description. Denote the reference plane as the x-y plane. There is a third dimension, the z dimension normal to this plane. Arbitrarily pick one direction on the z axis as positive and the other as negative. The "right ascension" part of the name "right ascension of ascending node" means to measure the angle as a right-hand rotation about the positive z axis. The "ascending node" part of the name means that one measures the angle from the reference line to the ascending node, the point where the planet crosses the reference plane with an increasing z direction.

This still doesn't pin the orbit down completely. Rotate an ellipse with a given size and shape and you get another ellipse with the same size and shape. Fix the angle and you get a single ellipse. That angle is the "argument of periapsis", the angle between the ascending node and the point of closest approach (periapsis), measured positive in the direction of planet motion.

Altogether, seven parameters:

$$a$$ the semi-major axis length

$$e$$ the eccentricity of the orbit

$$i$$ the orbital plane inclination

$$\Omega$$ the right ascension of ascending node

$$\omega$$ the argument of periapsis

$$\nu$$ the true anomaly at some epoch time

$$t$$ the epoch time.

Wow, I think that's a little more than he was asking for, D H. Why not add the 1/r^4 correction to Newton's law of universal gravitation while you're at it?