code: public final double getDistanceKmToPath(Position p1, Position p2) {
  		double d = radiusEarthKm
  				* asin(sin(getDistanceToKm(p1) / radiusEarthKm)
  						* sin(toRadians(getBearingDegrees(p1)
  								- p1.getBearingDegrees(p2))));
  		return abs(d);
  	}
docs: calculates the distance of a point to the great circle path between p1
  and p2.
  
  Formula from: http://www.movable-type.co.uk/scripts/latlong.html
  
  @param p1
  @param p2
  @return