Hello. Suppose I have 3 geographical coordinates given by latitude and longitude, the first two of which arc, and the third lies outside. Is there a way to find the nearest point on the arc to the third point and the distance to it?

  • There is definitely a way. If the distance is calculated along an arc, then there will be the same logic as the shortest distance from the point to the segment. You need to look for a perpendicular. And you can just make a neat projection. Well, or use the ternary search. - pavel
  • through two points you can draw an infinite number of arcs. it is not very clear how they form it. And through any three you can draw a circle :) - splash58
  • Yes, there is a way to find and so on. This way is to study geometry in the volume of the eighth grade of high school (or is it already the ninth now?). - Igor
  • @ splash58, this is not an arbitrary arc, but a segment of a circle. - ߊߚߤߘ
  • @Arhad is good, we formulate it like this: through two points you can draw an infinite number of circles. The centers of which lie on a straight line, perpendicular and passing through the center of the segment connecting the points - splash58

2 answers 2

Well, here's your outline.

For calculations go to the Cartesian coordinate system, it is terribly inconvenient to calculate in terms of latitude and longitude.

The nearest (i.e., the point you need) lies in a plane perpendicular to the arc and passing through a third point not lying on this arc.

Points

A, B and C - data points, X - the desired. The mentioned plane is painted blue.

The perpendicular of the arc of a circle is always "looking" from the center O of this circle. Due to this, the plane perpendicular to the arc always passes through this center.

To find this plane, you need to find two vectors lying in it, and then find the normal (perpendicular) to this plane using their vector product. Let these vectors be:

  • third point radius vector

  • normal to arc. It can be counted as a vector product of the radius vectors of points A and B lying on an arc.

Vectors

R A , R B R C are the radius vectors of the points A, B, and C, respectively, N is the normal to the arc. By the way, N can look the other way (it depends on the order of the factors in the vector product), but in general it does not matter.

It is worth noting that we will not express the equation of the plane. We only need her normal.

Now we will construct another plane passing through the arc and the center, and we will find the line of intersection of these two planes (in the first figure this is the line OX ). The planes are obviously perpendicular (since the CX and AB lying in each of them are obviously perpendicular), therefore the direction of the direct intersection can be found through the vector product of their normals; as the free term of the equation of this line, we can take the center of the sphere O.

Now, moving away from O along OX by the distance of the radius of the sphere, you will get the desired point. More precisely, two, since along OX you can go in two directions.

It remains to find out which of these points we need. If only one of them lies on the arc AB , then the answer is obvious. In the case when both points lie on the arc, you have to compare the distances and find the minimum.

  • I would like to read the minus comments. - VladD
  • Most likely minus a lot for the complexity of the wording. Now I will try to correct the situation. - ߊߚߤߘ
  • @Arhad: Oh, well, yes, as if, if it’s detailed, it will be long, but I'm lazy. And I will not write the finished code, of course. - VladD
  • Laid out half the revised text. It’s just that most people don’t take long sheets with complex sentences. Plus, spatial thinking is not developed at all. - окт
  • @VladD you probably did not learn spherical trigonometry :) - Barmaley

This is a typical problem of spherical trigonometry - that is, when points / lines are on the surface of a sphere, and not on a plane.

The general pattern of spherical trigonometry problem solving is as follows:

  1. Transfer the solution to planimetry (i.e. on the plane)
  2. Solve it using conventional means using the sine and cosine theorem
  3. Then go back to the sphere and replace the flat sine and cosine theorems with their spherical analogues: the spherical cosine theorem and the spherical sine theorem

That is, you have a segment and a point. It is necessary to lower the height on this segment and understand where the height intersects the segment - this will be the desired point. A task for a schoolboy ... Just remember that some planimetric theorems cannot be used - for example, on a plane the sum of the angles of a triangle is always 180, and on a sphere there isn’t - there is a so-called. spherical excess.

In general, something like this.