# Distance between a satellite and an orbit

I would like to compute the distance between a satellite and a specified orbit. For instance, for an orbit at 897 km altitude, 0 degree eccentricity, 99 degree inclination, and RAAN of 0 degrees on Jan 01, 2023 00:00:00 GMT (Sun Synchronous Orbit), is there a way to calculate the distance from the International Space Station to the closest point on that orbit?

I can imagine converting a bunch of points on that orbit to ECI coordinates and then computing the distance between them and the ISS and choosing the smallest. I could further interpolate points between the two closest points on the orbit if I needed finer granularity.

I'm wondering if there is a clever geometry trick that I can use instead of calculating all of those distances. If I could convert the Keplerian components of the orbit to the parametric equation of an ellipse, I could use this but the conversion to the ellipse seems to be less than straightforward (see here).

• Maybe a two-step solution would work: First, find the point in the plane of the ellipse that is closest to the satellite in 3-D space, by using the normal form of said plane. Once you have that point, you are reduced to a 2-D problem and you just have to find the closest point from that footing point to the ellipse. Feb 6 at 20:57

Partial answer too long for a comment.

### Method #1

1. Keep the center of the Earth as the origin.
2. Rotate your orbit and your point at the same time about the x and the y axes until the orbit is in the xy plane.
3. Rotate them a third time about z so that the line of apses is parallel to x or y.
4. Express the 2D orbit as the usual $$r(\theta) = \frac{a(1-e^2)}{1-e \cos(\theta)}$$ and use $$x, y = r \cos(\theta), r \sin(\theta)$$
5. Express the distance to your point $$(x_0, y_0, z_0)$$ squared as $$r^2 = (r \cos(\theta) - x_0)^2 + (r \sin(\theta) - y_0)^2 + z_0^2$$ and take the analytical derivative of $$dr^2/d\theta$$ and set it to zero (minima, maxima, inflections)
6. This will be a transcendental equation and probably the roots will not have analytical solutions (though if you are a goat there can be pleasant surprises!) so use a canned numerical routine to find the solution (root) that has the shortest distance. It's 1D in $$\theta$$ so I think if you simply start Newton's method at a half-dozen equally spaced points in $$0 \le \theta \lt 2\pi$$ you'll always get the answer in a few dozen microseconds.

### Method #2

1. Move your orbit and point so that the center of the ellipse is at the origin
2. Same as above
3. Same as above
4. Express the 2D orbit as the usual $$x^2/a^2 + y^2/b^2 = 1$$
5. Rewrite your ellipse as $$x(y)=\pm a \sqrt{1 -y^2/b^2}$$
6. Plug into your distance equation, getting $$r^2 = \left(\pm a \sqrt{1 -y^2/b^2} - x_0\right)^2 + (y - y_0)^2 + z_0^2$$
7. Take the analytical derivative of $$dr^2/dy$$ and set it to zero (minima, maxima, inflections)
8. Hope that the resulting polynomial (this answer to your linked question suggests it might be a quartic) is one that has analytical expressions for its roots! If not, use a canned root finder as discussed in step 5 above.

### Method #3

1. Sigh after reading methods #1 and #2
2. Realize that computers are here to stay
3. Reconsider "I can imagine converting a bunch of points on that orbit to ECI coordinates and then computing the distance between them and the ISS and choosing the smallest" and consider how many hours of your time you'll save by letting a computer spend milliseconds doing it this way.