- #1
neros
- 1
- 0
... on a sphere. Ok, so this isn't really a homework question (I haven't done homework in years), but rather is a problem I've been trying to figure out for the last few hours for a programming issue I have run into. So if this is the wrong forum, feel free to move it (and I apologize).
Basically, picture a sphere of radius r. Along the surface of the sphere, there is a line segment AB (a "great circle" in navigation terms) which goes from (r, A_theta, A_phi) to (r, B_theta, B_phi) (in spherical coordinates).
Next, there is a point on the surface of the sphere, C (r, C_theta, C_phi). I am trying to determine the shortest distance from C to the line segment, traveling along the surface of the sphere. If this was a line segment in rectangular coordinates, I would solve for a point P, along the line AB, where CP dot AB = 0, and determine of the point is inside of the segment AB, or if it is off one of the two end points.
That being said, I have no idea how to do this for the surface of a sphere. I have thought about trying to "unwrap" the space, but this would leave me with a curve to find the distance to, and because spherical coordinates are not orthogonal, one can't use a dot product. Any ideas would be greatly appreciated.
Basically, picture a sphere of radius r. Along the surface of the sphere, there is a line segment AB (a "great circle" in navigation terms) which goes from (r, A_theta, A_phi) to (r, B_theta, B_phi) (in spherical coordinates).
Next, there is a point on the surface of the sphere, C (r, C_theta, C_phi). I am trying to determine the shortest distance from C to the line segment, traveling along the surface of the sphere. If this was a line segment in rectangular coordinates, I would solve for a point P, along the line AB, where CP dot AB = 0, and determine of the point is inside of the segment AB, or if it is off one of the two end points.
That being said, I have no idea how to do this for the surface of a sphere. I have thought about trying to "unwrap" the space, but this would leave me with a curve to find the distance to, and because spherical coordinates are not orthogonal, one can't use a dot product. Any ideas would be greatly appreciated.