Perpendicular Distance from Point to Arc

I am sure the major portion of this has been covered, but I have an exception that I need to hash out.

I want to find the intersection of two great circle arcs (numerically). I have already determined the location of the two intersection points of the two corresponding great circles. However, this leave me with the problem of determining which point lies on the great circle arc.

Letlet define the great circle arcs, , respectively, and let correspond to the intersections of the great circles. These intersections are antipodal of eachother, which is what causes my problem. To calculate the shortest distance between a point, and a great circle I use the following

then the perpendicular distance is given by

.

From here I check to see if .

But, because of I get that both are on the arc. How do I get the proper angle from using the information given?

Re: Perpendicular Distance from Point to Arc

Is this a poorly asked question? It seems strange that no one has been able to answer this.

Re: Perpendicular Distance from Point to Arc

It is a little difficult to follow. I assume that one great circle arc is defined by two vectors p1 and q1, and the other by p2 and q2, correct? So you are trying to find the angular separation between X and either one of the great circles. I don't understand what you mean by "I get that both I_1 and I_2 are on the arc" -- they are the intersection points of the two great circle arcs, so yes, they are both "on the arc."

I also don't get the formula for angular separation: : it seems with this formula that if X is on the arc then X is perpendicular to n, the dot product of n and X is 0, and hence the formula yields instead of 0 as expected. I would think would work better? One other thing - the values for theta ought to lie between 0 and pi/2, if the dot product yields a negative number I think you want to use its absolute value:

Re: Perpendicular Distance from Point to Arc

I define two Arcs by the points respectively, just as you said. What I want is . However, the way I have done this is by finding the intersection of the of two great circles corresponding to the given points. Since I find the intersection of two great circles, I get two intersections . Only one of these two points actually lies on , so I figured I could just find the distance of each point to one of the arcs; the point with an angular distance closest to 0 would be the intersection of the two arcs. However, I get the same angular distance for both points. I hope this description is clearer.

EDIT: The problem is that both and lie on the great circle, however only one lies on the arc. The question is how do I determine which lies on the arc?

Re: Perpendicular Distance from Point to Arc

Quote:

Originally Posted by

**lvleph** The problem is that both

and

lie on the great circle, however only one lies on the arc. The question is how do I determine which lies on the arc?

OK, I see. Two great circles will intersect at two points (assuming they are not coplanar), whereas two circle segments may have 0, 1 or 2 intersection points. How about this - if the angular distance from p to I_1 plus the angular distance from I_1 to q equals the angular distance from p to q then I_1 is between p and q and hence on the arc. If I_1 is not on the arc then the sum of these angles would be greater than the arc. You would have to use positive angles only, and control for the case where the arc is greater than 180 degrees.

Re: Perpendicular Distance from Point to Arc

That sounds plausible. The other solution I was thinking might works is to look at and the smaller distance is the point I want. This will work because I know my arcs are small.

Re: Perpendicular Distance from Point to Arc

If the arcs are always less than 90 degrees in length and if there is always an intersect point on the arcs then yes, it would work.

Re: Perpendicular Distance from Point to Arc

Good point, part of what I am checking is if there is even an intersection, so my method won't work.

Re: Perpendicular Distance from Point to Arc

Numerically, your test has a problem. If the intersection is one of the end points of an arc it can cause acos to throw NaN. But, I can detect this.