in reply to Re: Algorithm: point with N distance of a line between two other points
in thread Algorithm: point with N distance of a line between two other points

In fact, I believe that you want ...

(sort { $a <=> $b } (|CA|, |CB|, |CP|))[1]

where |...| means "the distance between these points". Of course, because the OP is working with points on a curved surface, he may need to work with great circle distances (and even then he has to allow for the planet not being spherical if he wants to be *really* precise) whereas lots of the solutions you'll find online assume that you're working on a plane. The assumption that the surface is a plane really breaks down once you're talking about distances of more than a few hundred km.

  • Comment on Re^2: Algorithm: point with N distance of a line between two other points
  • Download Code