What you are looking for is a great circle route formula. If you could draw a perfectly straight line through a basketball from one point to the other (you will have to go through the ball) and then transpose that line to the surface you will have the great circle route. Here is a website I use to calculate such things.
http://www.movable-type.co.uk/scripts/latlong.html
Here is the Haversine Formula from that website
Haversine formula:
a = sin²(Δlat/2) + cos(lat1).cos(lat2).sin²(Δlong/2)
c = 2.atan2(√a, √(1−a))
d = R.c
Where R is earth’s radius (mean radius = 6,371km); note that angles need to be in radians to pass to trig functions!