# Point along great circle line (aka arc) closest to a target point on the ground

Given:

• an arc (aka a great circle line, not a straight-line) defined by two arbitrary end points (which I can express in lat/lon/altitude or earth-centered fixed (ECF) 3D 'cartesian' space). Think of this as the flight path of a plane (altitudes can change from the beginning of the arc to the end).
• an arbitrary point (call it 'target') on earth's surface (again, expressible in lat/lon/alt or ECF).

How can I find the point along the arc that is closest to 'target'? Note that altitude/z should be accounted for, only the 'target' is guaranteed to be on the ground.

I'm grateful for any replies. Solutions based on vectors or well-explained solutions that leverage quaternions are preferred, but at this point any solution will work! I have googled this ad naseum and keep finding straight-line solutions but no arc (great-circle line) solutions.

Thanks from Florida!

Let $T$ be the target point and $\gamma$ the arc. Consider an arc $\beta$ through $T$ that is perpendicular to $\gamma$. Then the point in $\gamma$ closest to $T$ lies in the intersection of $\gamma$ with $\beta$.