- #1
Fredster
- 2
- 0
Hi all,
Let me state up front that I'm a math idiot. I minored in it in college 20+ years ago and haven't needed it as a software engineer...until now.
I'm trying to solve a problem for work that's got me pulling my hair out, mostly because I'm having to relearn so much math I'd forgotten. What I'm currently struggling with is this:
Given two points (A and B) on the Earth, which I can assume is spherical because my calculations don't have to be super-accurate, imagine the minor great circle arc connecting them. If I have a third point C, I'd like to know the distance between AB and C. I know how to find the distance between C and the great circle itself, but that's not exactly what I need unless C happens to be perpendicular to the great circle somewhere along AB. Chances are very good that C will most often actually be closest to A or B.
I've been doing all my other work with these points as unit vectors instead of lat/lon, and if there's a solution to my problem that's easily done with vectors, I'd like to do it that way. I've implemented the algorithm here:
http://mathforum.org/library/drmath/view/51785.html
and what I'm really hoping is that I can just put a couple of checks at the beginning to see if C happens to be closest to A or B before doing those calculations. In a linear system, I can use the dot product to determine where C lies relative to AB, and I suspect (or at least hope!) that something similar can be done in a spherical system. I just don't know what to do.
Thanks in advance for anyone who can help out, and please use small words because l'm easily confused. :)
Let me state up front that I'm a math idiot. I minored in it in college 20+ years ago and haven't needed it as a software engineer...until now.
I'm trying to solve a problem for work that's got me pulling my hair out, mostly because I'm having to relearn so much math I'd forgotten. What I'm currently struggling with is this:
Given two points (A and B) on the Earth, which I can assume is spherical because my calculations don't have to be super-accurate, imagine the minor great circle arc connecting them. If I have a third point C, I'd like to know the distance between AB and C. I know how to find the distance between C and the great circle itself, but that's not exactly what I need unless C happens to be perpendicular to the great circle somewhere along AB. Chances are very good that C will most often actually be closest to A or B.
I've been doing all my other work with these points as unit vectors instead of lat/lon, and if there's a solution to my problem that's easily done with vectors, I'd like to do it that way. I've implemented the algorithm here:
http://mathforum.org/library/drmath/view/51785.html
and what I'm really hoping is that I can just put a couple of checks at the beginning to see if C happens to be closest to A or B before doing those calculations. In a linear system, I can use the dot product to determine where C lies relative to AB, and I suspect (or at least hope!) that something similar can be done in a spherical system. I just don't know what to do.
Thanks in advance for anyone who can help out, and please use small words because l'm easily confused. :)