I have a line segment (great circle part) on earth. The line segment is defined by the coordinates of its ends. Obviously, two points define two line segments, so assume I a
The shortest distance between two points on a sphere is the smaller side of the great circle passing through the two points. I'm sure you know this already. There is a similar question here http://www.physicsforums.com/archive/index.php/t-178252.html that may help you model it mathmatically.
I'm not sure how likely you are to get a coded example of this, to be honest.