This is specifically a Google Earth API question, but any general geographical solution that can be adapted to it is fine, too.
I'm using the Google Earth API to dynamically put a placemark somewhere on the Earth. Like all placemarks, it has a fixed latitude and longitude. In this case, the altitude is basically always 0. After the placemark is placed, the user may fly the camera around somewhere else and the placemark may not be visible.
What I'd like to be able to do is have a button that would let you automatically look in the direction of the original placemark without changing the camera's position.
In Google Earth API, the user's viewport is represented by a Camera object, which has a latitude and longitude as well as a heading (left-to-right axis) and tilt (up-and-down axis).
So the question can be reduced to: if you have a fixed point on a globe at (lat1, lng1, alt1), how do you calculate the heading and tilt for a camera at (lat1, lng2, alt2) so that it is facing that position?