# Spherical coordinates: initial bearing to intercept

I'm trying to expand a Haversine-based spherical navigation library I've created for a computer game I'm developing. Currently, missiles "chase" their targets by simply computing the initial heading for the shortest great circle arc to the target, per frame; I'm trying to find a way to get them to "intercept" their target along the shortest possible arc instead.

The nearest I can get to this with Google is the intersection of two great circle arcs. My problem extends that somewhat with speed and time.

I'm trying to work out; given an object, at a given set of spherical coordinates, moving along a great circle arc with a current given compass bearing; compute, from another set of spherical coordinates, the initial bearing such that another object setting off from here with a given different speed will intercept the first object along the shortest possible great circle arc.

Layman's description: An aircraft is cruising around the world with a constant speed. You are a SAM site. Calculate the initial bearing your interceptor missile has to take in order to shoot it down by following the shortest possible path.

My own working so far is has been rubbish. The best I've done is come up with the obvious stipulation "They must end up in the same place, after travelling for the same amount of time", which applies to trivial 2D planar geometry.

Although I don't know what "the intersection of two great circle arcs" is, I think this problem needs differential equation which can compute the curve's length, but I didn't calculate that. If you want to know some algorithm of this type, you should ask in game-stackexchange, computer science, or computer graphics.

$(1)$ normal missile(or advanced homing missile which expect opponent's path)

The shortest path is perpendicular to line of aircraft. Then if both speed is same, he should shoot at 45 degree against the line.

$(2)$ pure homing missile

If aircraft and missile are line up on vertical or parallel line, they never can meet eternally. He must shoot faster than the time of 45 degree, because if the angle is less than 45 degree, even if missile go straight down, missile never meet. However even if it is faster than 45 degree, since the angle of aircraft and missile comes to 45 degree, finally both never can meet.

$(3)$ missile of great circle arc

This path can be nearer value of (1) by bigger circle arc.

Therefore $(1)>(3)>(2)$.

• A great circle arc is the shortest path across the surface of a sphere between two points on the sphere (i.e. "straight line" between two places; although on a 2d map of the world it never appears straight). The Haversine Formula determines the distance between the points across the surface; from which other stuff can be derived. Unfortunately, since games almost universally approximate world spaces to Cartesian constraints, geo navigation is quite rare. My game simulates cruise missile warfare, with players all over the world, so Cartesian approximation is out of the question! – Toby Wilson Mar 14 '17 at 9:25

You need to derive the equations of motion for the target and for the missile. I don't know spherical geometry, so I'll illustrate with plane geometry. Let a subscript of "m" stand for a missile related quantity, and "a" for an aircraft quantity. For example $s_m$ is missile's (scalar) speed and $p_{a0}$ is aircraft's vector $(x,y)$ position at time $t_0$.

The various quantities I'll use are $s_m, s_a, p_{a\mathbf{t}}, p_{m\mathbf{t}}, p_{ax\mathbf{t}}, p_{ay\mathbf{t}}, m_a, m_m, l_a, l_m$, which are the scalar speeds, the vector positions at time $\mathbf{t}$, the x and y coordinates of the aircraft at time $\mathbf{t}$ (similarly for $x,y$ of missile's position), the slopes of the lines the aircraft and missile are following, and whether the direction of travel is left to right (with a value of 1) or right to left (with a value of -1). I'm not handling the case where either slope is infinite (straight up or down). I realize that using slope and direction is an awkward way to represent bearing - you'll probably want to use some other method.

I'm assuming the missile launcher can detect the aircraft's speed, slope/direction, and current position. Let $p_{t0}$ be the aircraft's position at $t_0=0$. Then at time t, the aircraft's position is $$p_{a\mathbf{t}} = (p_{ax0} + l_a(\frac{s_at}{\sqrt{1+m_a^2}}),(p_{ay0} + l_asgn(m_a)\frac{s_atm_a}{\sqrt{1+m_a^2}})$$ where $sgn()$ is the sign function. Similarly $$p_{m\mathbf{t}} = (p_{mx0} + l_m(\frac{s_mt}{\sqrt{1+m_m^2}}),(p_{my0} + l_asgn(m_m)\frac{s_mtm_m}{\sqrt{1+m_m^2}})$$

To find the intercept point you need to determine the time of flight ($t$) and slope/direction ($m_m,l_m$) of the missile. At intercept $p_{mx\mathbf{t}} = p_{ax\mathbf{t}}$ and $p_{my\mathbf{t}} = p_{ay\mathbf{t}}$. This gives you two equations to find three unknowns. However if you represent bearing as one quantity (instead of two like I have here), then you'll have two unknowns. There's no point in me solving these equations, because the equations for the spherical case will be different.

HTH

• That's an option I looked at; it turns out it's incredibly complicated (at least at my level of ability) to derive for spherical geometry. For one thing, this problem has only one solution with planar geometry, but for spherical geometry there are multiple solutions (could be theoretically infinite, if you don't constrain the number of times you can "go around the world" in order to intercept!). – Toby Wilson Mar 14 '17 at 9:33
• Have you googled for "spherical geometry equations of motion"? e.g faculty.trinityvalleyschool.org/hoseltom/labs/…. Or looked at math.stackexchange.com/questions/494715/…. Don't worry much about having multiple solutions. The inverse trig functions all have multiple values, but they aren't difficult to deal with. You might find this useful: sjsu.edu/faculty/watkins/sphere.htm. The comment at the link suggests there are computer libraries to deal with spherical navigation. – Χpẘ Mar 18 '17 at 23:15