Jump to content

Spherical geometry


Recommended Posts

Yesterday I posted an equation in the "What did you do in KSP" thread. It can be used to calculate the burn angle required to achieve a specific inclination, based on the orbital and ground velocity.
Due to the planet's rotation around itself, inclination angle and burn angle won't line up exactly; you'll burn slightly more northern/southern than the inclination demands to cancel it out.


And the equation works as expected! You can put in any number and it will give you the correct angle to burn at. However, it has a slight problem that makes sort of makes it unusable for most cases.
On Kerbin it works perfectly fine, but it is assumed for the calculation that the starting point (i.e. the launch pad) is exactly on the equator.


Now, the varying ground speeds at different latitudes are not problematic at all; it's variable, you can use any value. Want to find the angle required if Kerbin rotated 10x faster? Go ahead!
The problem is that on a sphere, the angle at which the orbit intersects a line of latitude changes constantly as you move "up" and "down" (north/south) in the orbit. At its most northern/southern point it will run perfectly parallel, for instance, while at the equator it will have the highest angle before it decreasing again.


The solution to the original problem is essentially two-dimensional, this one requires the third dimension to be solved. And 3D space, most of the time, is a mess. So I may need some help generalizing the equation to work in any arbitrary situation, at any latitude and with any inclination as long as it's achievable.
I fear that it is a little more complicated than I think, and the third dimension is something I never really required so far, so this is entirely new to me.


I know there probably are equations online somewhere, but I prefer to derive things myself. I also made my own launch window calculator for the same reason, rather than using the dozens of online apps available.
I don't hate using already existing equations, I just don't like it.

Essentially what I need is merely a way to figure out how to calculate the angle of intersection between orbital plane and line of latitude. This angle then becomes the inclination you're aiming for and the equation works as expected again, giving accurate results.

Edited by Delay
Link to comment
Share on other sites

You basically need spherical geometry, much like spherical celestial coordinates. It's a 2D problem, just on a positively curved plane (as we're entirely interested in only the angles and not the radial distances).

You will need :

- True anomaly

- Inclination

- Longitude of Ascending Node (to pin down where the intersection are)

+ The current latitude, which can be derived off from both true anomaly and inclination, as the path that the orbit creates will look like a sine wave on the geographic coordinate.

The equations that will help you solve the required angle are the following :




Point U is the north pole; Point V is the ascending node, point W is where the spacecraft is on.

Circle a is the longitude line at ascending node; Circle b is the longitude line where the spacecraft is; Circle c is the orbit path.

α = a = 90° (Ascending Node always at the equator)

β = b = 90° - (current latitude)

γ = c = True Anomaly

Angle A is opposite of side a (at point W), angle B is opposite of side b (at point V).

A = 90° + ("inclination")

B = 90° - (inclination)

Your answer is the "inclination".


EDIT : Whoops, I misunderstood your question entirely !

Edited by YNM
Link to comment
Share on other sites

59 minutes ago, YNM said:

α = a = 90° (Ascending Node always at the equator)

β = b = current latitude

γ = c = True Anomaly

Angle A is opposite of side a (at point W), angle B is opposite of side b (at point V).

A = 90° + ("inclination")

B = 90° - (inclination)

Your answer is the "inclination".

That seems a little too highbrow to me.
Would it be possible to provide a more in-depth explanation?

Link to comment
Share on other sites



sin(90 - i) / sin(90 - latitude) = sin(90 + Cross Angle)/sin(90)? Given their equality I should be able to drop one of them.

The sin of 90 is 1, so it's equal to sin(90 + Cross Angle)

sin(90 - x) = cos(x)

cos(i) / cos(latitude) = sin(90 + Cross Angle).

Edited by Delay
Link to comment
Share on other sites

3 minutes ago, Delay said:

cos(latitude) / cos(i) = sin(90 + Cross Angle).


Keep in mind that this is only for the initial conditions; still not sure how you would have to cope with the differential rotation stuff.

Link to comment
Share on other sites

22 minutes ago, YNM said:

still not sure how you would have to cope with the differential rotation stuff.

I should still be able to use that part of the original equation. I only needed a term to correct the inclination for launching at a non-zero latitude.


What my original equation does is basically vector addition - but instead of adding vector "a" to vector "b" to get vector "c", I have "b" and "c" given and solve for "a". Or more specifically: The angle of "a".

"b" represents the rotational speed of Kerbin (~175m/s). It's angle doesn't matter, since it's always parallel to the equator. The magnitude of "c" represents orbital velocity (~2270m/s) and the direction represents the inclination.

My reasoning is that "b" only varies in magnitude as your latitude increases. It's direction is always the same. The orbital speed doesn't change and so does the inclination of the orbit, so "c" is constant.
I should be able to reuse the equation entirely - only substituting "i" for this slightly more complicated correcting function.

Edited by Delay
Link to comment
Share on other sites

So, I'm starting to work through this myself, with extensive help from Wikipedia. I'm taking as the three points: the ascending node, a northern-hemisphere launch site*, and the north pole. All angles are in degrees. I am not yet including the rotation of the body you're launching from.

*Empirically, the calculations I'm doing seem to be robust to southerly launch sites, and I think that's correct, though I'd have to do more math to prove it to myself.

Bolded is the "I just want this quick" stuff.


Some definitions:

L is latitude of the launch site.

N is the inclination of the target orbit.

a is the length of the arc from the ascending node to the launch site. This is the true anomaly of the launch site on the target orbit.

b is the arc length from the launch site to the north pole. This is (90-L).

c is the arc length from the ascending node to the north pole. This is always 90 degrees.

Alpha is the angle opposite a. This, I think is the difference in longitude between the ascending node and launch site.

Beta is the angle opposite b. For prograde orbits (N < 90), Beta = 90 - N. For retrograde orbits (90 < N < 180), Beta = N - 90.

Gamma is the angle opposite c. This is one of the key unknowns; it's the angle between due north and your target orbit.


We have arclengths b and c, and angle Beta. The easiest unknown to calculate is Gamma... which is fortunately the easy value to get, with the spherical law of sines.

Spherical Law of Sines: sin(a)/sin(Alpha) = sin(b)/sin(Beta) = sin(c)/sin(Gamma).

Rearrange this a bit, and you get Gamma = sin-1(sin(c)*sin(Beta)/sin(b)). This simplifies a bit since c = 90 and sin(90) = 1.

Gamma = sin-1(sin(Beta)/sin(b))

To get the unnecessary quantities a and Alpha, look into the spoiler and/or Wikipedia:


a = 2*tan-1(tan(0.5*(b-c))*(sin(0.5*(Beta+Gamma))/sin(0.5*(Beta-Gamma))))

Alpha = 2*cot-1(tan(0.5*(Beta-Gama))*(sin(0.5*(b+c))/sin(0.5*(b-c))))

In terms of the original variables (latitude, inclination), this means Gamma = sin-1(sin(90-N)/sin(90-L)).



Now that you have Gamma, there are four possibilities*:

Prograde: either launch to Gamma, or 180 - Gamma

Retrograde: either launch to 180 + Gamma, or 360 - Gamma

*The reason why you have two options is because the arcsin (sin-1) operation actually has two valid solutions, but most calculators only give you one solution.


All of this was validated with a third-party tool... which doesn't seem to include the rotation of the body you are launching from. Presently working on incorporating rotational velocity.

Edited by Starman4308
Bit of proofreading
Link to comment
Share on other sites

2 minutes ago, Delay said:

Are you sure? Keep in mind that y is inside the sin(), but not inside sin-1().

Whoops, my bad. In that case they don't.

2 hours ago, Starman4308 said:

Empirically, the calculations I'm doing seem to be robust to southerly launch sites, and I think that's correct, though I'd have to do more math to prove it to myself.

If the signs remain as expected, then yes it is correct.

Link to comment
Share on other sites

I tested the equation yesterday. I placed myself at 46.5° N and launched into a 70° orbit. Unfortunately I have neither an RSS save nor Making History, so I don't have any inclined launch sites I can actually launch from.
So I built my rocket, turned on infinite fuel, flew there, landed, turned infinite fuel off and then launched as normal.

The orbit seems to line up really well. I only had a few meters per second, 100m/s at worst, of deviation.


2 hours ago, Starman4308 said:

Empirically, the calculations I'm doing seem to be robust to southerly launch sites, and I think that's correct, though I'd have to do more math to prove it to myself.

I don't see a difference between launching in the northern hemisphere relative to the ascending node and launching in the southern hemisphere relative to the descending node.

Launching south from the northern hemisphere / north from the southern hemisphere also shouldn't be a problem - the orbit instersects all latitudes twice (aside from lat = inclination).
You're just moving your own position from "local ascending node" (if I can call it that) to "local descending node", the angles should remain intact.

Link to comment
Share on other sites

I'm pretty confident I now have it worked out when incorporating rotational velocity*. Fortunately, planar trigonometry is simpler than spherical trigonometry. Thanks to @YNM and @Delay for double-checking the assertion about north vs. south launch sites.

*Plus or minus minor error caused by an increase in altitude between launch site and parking orbit. That, though, would probably require outright numerical simulation of the launch profile.



Gamma is the value solved for up above: the angle between north and your orbital track (as of the launch site latitude).

L is as above: latitude of the launch site.

Phi is the angle between due west and your launch angle.

Re is the rotational velocity of the planet at the equator.

R is the rotational velocity of the planet at the launch site latitude.

Vo is the velocity of the target orbit. To minimize error caused by the difference in target altitude and launch site altitude, I recommend calculating based on a low parking orbit.

VL is the delta-V of your launch, minus any gravity/atmospheric losses.


The first thing is to construct a triangle of three vectors. 

Vector A is an eastbound vector of magnitude R (the eastwards spin at the launch site).

Vector B is the orbital vector, of magnitude Vo.

Vector C is the launch vector, of magnitude VL.

Gamma is opposite vector C, and phi is opposite vector B.


The second step is to calculate the angle between east and your orbital track. This is not Gamma, since Gamma is defined with respect to north, not east. Fortunately, it's a simple rotation.

Theta = 90 - Gamma


The third step is to calculate the body's rotation at the launch site. Fortunately, this is a simple cosine multiplication based on latitude.

Re = diameter / sidereal rotational period

R = Re * cos(L)


The fourth step is to calculate VL. For this, we turn to the planar law of cosines: c2 = a2 + b2 - 2ab*cos(gamma), where gamma is the angle opposite c.

VL = sqrt(R2 + Vo2 - 2*R*Vo*cos(Theta))


The fifth step is to calculate phi. Once again, it's the planar law of cosines, rearranged to calculate an angle.

Phi = cos-1((R2 + VL2 - Vo2)/(2*R*VL))


The sixth step is to rotate phi into an inclination. Launch angle 2 is calculated as a function of angle 1... but in reality comes from the twin solutions to the arccosine.

Launch angle 1 = 90-Phi

Launch angle 2 = 180 - Launch angle 1


Now to actually complete the "First Polar Orbit" contract out of Tanegashima...

Edited by Starman4308
Link to comment
Share on other sites

1 hour ago, Starman4308 said:

Phi = cos-1((R2 + VL2 - Vo2)/(2*R*VL))


Substituting i in my original equation for the spherical "extension", I got this huge thing, which I have made in GIMP for better readability:


vO is still the orbital velocity, i is the inclination, L is latitude and vR is the rotation of the body.

My equation is based on a right triangle, with its vertical component at the top and the horizontal one at the bottom.

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...