Jump to content

Sine Graphs and Orbital Paths


Recommended Posts

So as I was rewatching the 0.23.5 release trailer, I noticed the orbital path on the big screen in the control room. But then I thought that the path looked an awful lot like a graph of the sine or cosine functions. Compare this:


To this:


So, the question is: what equation defines the graph of the projection of inclined orbits onto a map? I think inclination affects amplitude, but I can't really figure anything else besides that. Shifting shouldn't be a factor because the orbit shifts itself, but what function defines the shift that occurs with each orbit relative to orbital period and inclination? How would one figure this out?

Link to comment
Share on other sites

It depends a lot on the projection, but the picture you show is based on equirectangular projection, which makes the most sense for this sort of application.

For an equirectangular projection, call the horizontal position (longitude) Æ and vertical position (latitude) θ. (So we are looking to plot function θ(Æ).) For a circular orbit with inclination α, where α = 0 corresponds to equatorial orbit, the latitude is given by the function:

θ(Æ) = sin-1(sin(Æ - Æ0) sin(α) / Sqrt(sin²(Æ - Æ0) + cos²(Æ - Æ0) cos²(α)) )

Where Æ0 is the latitude of the ascending node. For non-circular orbits, the formula will be quite a bit more complex.

Edit: There, that should work. Though, it does not account for planet's rotation. If you want to throw that in, you'll need to figure out orbital period and adjust Æ accordingly.

Edited by K^2
Link to comment
Share on other sites

  • 3 weeks later...

K^2, is there a way to graph the lat/lon traversed over time? I'm having massive problems making an orbit like this in a 3D application/XYZ space using pure trig and I think spherical coordinates may be my way out. As longitudes are traversed more quickly at different latitudes, I have no idea where to start or even where to look for such a specific solution.

Anyway, here's the above equation made interactive on Desmos Graphing Calculator if anyone wants to play with it: https://www.desmos.com/calculator/ui8awrisw5


(for those wondering why it looks like a square wave, this is a near polar orbit (87° inclination), which, just like the poles of Earth in an equirectangular projection map, stretch out. A 90° inclination will return an actual square wave, and an equatorial orbit will be a flat line, and a 51° inclination like the ISS will return a nice soft sine-wave looking curve.

As for the math to make it mesh with the rotation of the Earth, divide a 24-hour day by the orbital period (let's use 90 minutes) (24x60)/90 = 16 360/16= a loss of 22.5° per orbit, so you'll want to sample the image once every 360-22.5=337.5° and stack the samples on top of each other to see your forthcoming orbits.

Link to comment
Share on other sites

Start with a circular orbit of radius r around the equator. At t = 0, T, 2T, ..., kT, you are back at (x,y,z) coordinate (r,0,0):

x = r cos(̉ۡt)

y = r sin(̉ۡt)

z = 0

É = 2À/T = sqrt(μ/r3)

Now rotate this orbit by the inclination angle α about the x axis:

x -> x

y -> y cos(α) - z sin(α)

z -> y sin(α) + z cos(α)

x = r cos(̉ۡt)

y = r sin(Ét) cos(α)

z = r sin(Ét) sin(α)

Now the orbit is correctly inclined, but the longitude of the ascending node is zero. So rotate the entire orbit about the z axis by Æ0, the new longitude of the ascending node:

x -> x cos(Æ0) - y sin(Æ0)

y -> x sin(Æ0) + y cos(Æ0)

z -> z


x = r cos(Ét) cos(Æ0) - r sin(Ét) cos(α) sin(Æ0)

y = r cos(Ét) sin(Æ0) + r sin(Ét) cos(α) cos(Æ0)

z = r sin(Ét) sin(α)

θ(t) = asin(z/r) = asin(sin(Ét) sin(α))

Æ(t) = atan(y/x) = atan((cos(Ét) sin(Æ0) + sin(Ét) cos(α) cos(Æ0)) / (cos(Ét) cos(Æ0) + sin(Ét) cos(α) sin(Æ0)))

But note that you should use a 2-argument inverse tangent function atan2(y,x), because atan2(-y,x) is different from atan2(y,-x), which atan(y/x) can't tell.

And as mentioned above, if you want the coordinates relative to the surface of the body you are orbiting, subtract the rotation of the body: Æ(t) -> Æ(t) - Ébt.

Edited by Yasmy
Link to comment
Share on other sites

I managed to figure this out by generating the orbit which was simple to incline around one axis (I had already gotten that far by the time of my post), then transposing the XYZ to spherical coordinates, where it was simple to offset the longitude of the path being generated, and then converting back to XYZ.

Your solution is definitely more elegant though and I'd assume less prone to accrue error over time than my back-and-forth so I will definitely incorporate it into version 2.

Thanks a lot!

Link to comment
Share on other sites

  • 2 years later...

Hello everybody, I may have missed something, but what I assume are greek characters in this thread are displayed to me as a mangle of characters (for example "Ãâ€" for what appears to be Lambda and "ÃŽÂ" for what seems to be Phi. Is there a way to display those characters appropriately?

Anyway, I didn't wait for a solution and tried to implement Yasmy's formulas in one of my projects by identifying the characters and decyphering the formulas. It mostly works, I have all the orbital paths I want, except when my ascending node is set too close to Pi/4 mod(Pi/2) (ie 45°, 135°, etc) where I get non-sensical orbits. I tried to debug the formulas but the display errors makes it very difficult.

Below is an example of the problem I am running into; there are three curves, one of which is pretty and has ascending node at 0°, and the ugly ones are close to 45° and -45°.


Link to comment
Share on other sites

Nooo :o

Well, I will try to solve it myself. I'll post the corrected formulas here if I succeed.

Thank you anyway!

Edit: Turns out I made a mistake when I entered the formulas to generate my points. 


Here are Yasmy's equations in a readable form.

Circular equatorial orbit of radius r with angular speed omega, inclination phi0 and longitude of ascending node lambda0:

x(t) = r*cos(omega*t)

y(t) = r*sin(omega*t)

z(t) = 0

Note that omega = 2*Pi/T = sqrt(G*M/a3) with T the orbital period, G the gravitational constant, M the mass of the body and a the radius of the circular orbit.

Rotation around the x axis to change inclination to phi0 by the transformation:

x -> x

y -> y*cos(phi0) - z*sin(phi0)

z -> y*sin(phi0) + z*cos(phi0)

This gives us:

x(t) = r*cos(omega*t)

y(t) = r*sin(omega*t)*cos(phi0)

z(t) = r*sin(omega*t)*sin(phi0)

Rotation around the z axis to change longitude of ascending node to lambda0 by the transformation:

x -> x*cos(lambda0) - y*sin(lambda0)

y -> x*sin(lambda0) + y*cos(lambda0)

z -> z

That gives us:

x(t) = r*cos(omega*t)*cos(lambda0) - r*sin(omega*t)*cos(phi0)*sin(lambda0)

y(t) = r*cos(omega*t)*sin(lambda0) + r*sin(omega*t)*cos(phi0)*cos(lambda0)

z(t) = r*sin(omega*t)*sin(phi0)


We finally have:

phi(t) = sin-1(z(t)/r) = sin-1(sin(omega*t)*sin(phi0))

lambda(t) = tan-1(y(t)/x(t)) = tan-1((cos(omega*t)*sin(lambda0) + sin(omega*t)*cos(phi0)*cos(lambda0)) / (cos(omega*t)*cos(lambda0) - sin(omega*t)*cos(phi0)*sin(lambda0)))

And remember to use atan2(y,x) when possible to dissipate any sign ambiguity.


To have the coordinates of the orbiting object on the surface of the body, apply the transformation:

lambda(t) -> lambda(t) - omegab*t (With omegab the angular speed of the body's surface.)

Edited by Darkvidor
solved the problem, adding the solution to the post
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...