Something to keep in mind, by the way, if efficiency becomes an issue, is that when comparing distances you don't necessarily need to take the square root. For two positive numbers x and y, x < y is equivalent to sqrt(x) < sqrt(y). Therefore, if you are running in a tight inner loop and efficiency really matters (note:
this is unlikely to be the case) you can avoid the sqrt if you are just comparing distances (e.g., sorting the list of ships by their distance to some point).
As for the function names, in C++ you can do argument type overloading to have something like:
double ship_distance(const SHIP_DATA* ship1, const SHIP_DATA* ship2);
double ship_distance(const SHIP_DATA* ship, const PLANET_DATA* planet);
And if you use object orientation, you can further simplify this so that you have just:
If you wanted to get fancy, you would define these things as implementing some kind of interface that knows about position and velocity, so that with a single function, you can compute the distance between any