# [Proj] Intersection test for two geodesics goes wrong for very long distances

Mikael Rittri Mikael.Rittri at carmenta.com
Thu Feb 7 10:04:06 EST 2013

```> If you're going to start worrying about all the weird cases,

Right, I probably shouldn't.

The problem did come up in a real application; I wasn't
directly involved but I think it is about defining waypoints
in aeronautics. But I think that in actual practice, the two
start points are fairly near each other, and any useful
intersection is also in the vicinity.

I suspect the reason to try to use such a long forward
distance as 19 950 km was just to emulate a set of test
results from an older implementation that calculated on
a sphere.

Regards,

Mikael Rittri
Carmenta
Sweden
http://www.carmenta.com

-----Original Message-----
From: Charles Karney [mailto:charles.karney at sri.com]
Sent: Thursday, February 07, 2013 3:45 PM
To: Mikael Rittri
Cc: proj at lists.maptools.org
Subject: Re: Intersection test for two geodesics goes wrong for very long distances

On 2013-02-07 08:45, Mikael Rittri wrote:
> I suppose you are familiar with the article
>
>      L. E. Sjöberg,
>      Intersections on the sphere and ellipsoid,
>      Journal of Geodesy (2002) 76: 115-120.
>
> He writes: "each of the problems of intersection ... is solved without any limitation of arc length." I tried to read it, but the math was beyond me.
>

Yes, I'm familiar with this paper.  His basic technique for solving for
the intersection point is sound (see my comments in Sec 11 of
http://arxiv.org/abs/1102.1215 ).  But it requires that you've got a
reasonable first estimate of the intersection latitude and that you know
how many times each geodesic crosses that latitude before the
length" is merely an "aspirational" statement.

If you're going to start worrying about all the weird cases, you will
need to tighten up the definition of the intersection point.  Aside from
some degenerate cases, two 2 geodesics from points 1 and 2 with
prescribed azimuths intersect each other infinitely many times.
Presumably you're interested in a "first" intersection which I would
propose you define by requiring that the the intersection point 3
minimize

abs(s_13) + abs(s_23)

Depending on the application you might want to stipulate that s_13 >= 0
and s_23 >= 0 (i.e., you don't consider going backwards on the
geodesics).  One of the points of my previous E-mail is that there's no
guarantee that either of the geodesics 13 and 23, individually, be a
shortest path.

--Charles
```