Calculation of the spherical distance between two points on the Spherical Surface

Source: Internet
Author: User
Tags cos
Calculation of the spherical distance between two points on the Spherical Surface

 

In fact, this is a very simple problem. The reason why I proposed it and made a solution today is that when I discussed the project yesterday, it is difficult for lead to calculate the distance between two points on the Earth's sphere. It is actually a very simple Three-dimensional Geometric calculation. On the other hand, exercise the right to practice the C/C ++ language and exercise your design skills.

 

1.Raise Questions

The two points of the sphere are known. For convenience, the longitude and latitude are used to uniquely identify the position of the vertex (for related concepts, refer to 2. Related preparation knowledge), and their spherical distance must be calculated.

 

 

2.Prerequisites

The preparatory knowledge mentioned here is related to the Earth, such as the shape and size, latitude and longitude.

(1) shape and size:

The shape of the earth is a slightly flat irregular sphere at the poles. The mean radius of the earth is 6371 km, the Equator radius is 6378 km, and the polar radius is 6357 km. The circumference of the equator is about 40 thousand kilometers.

(2) weft and latitude, longitude and longitude

① Weft: the weft is a circle, also known as a weft coil, with varying lengths. The equator is the longest, gradually shortened from the equator to the Pole, and finally to a point. The weft indicates the east-west direction.

② Latitude: The equator is a zero-degree weft. The latitude to the north of the equator is called the north latitude, and "N" is used as the code. The latitude to the south of the equator is called the south latitude, and "S" is used as the code. The north latitude and the south latitude each have 90 °.

③ Meridian: Also called Meridian. The longitude line is semi-circular, and all longitude lines are of the same length. The longitude indicates the North-South direction.

④ Longitude: The Zero longitude line is called the prime meridian. The original meridian is divided into 180 degrees to the East and West, and the 180 ° to the east belongs to the east longitude. "E" is used as the code. The 180 ° to the west belongs to the west longitude, and "W" is used as the code.

The East-West 180 ° longitude line is a meridian line.

The earth is divided into two hemisphere regions, East and West, using the longitude coils of 20 ° W and 160 ° E.


 

3.Solution


 

For example, assume that the radius of the ball isR, The given 2 points areA,BLet's assume thatAIn the northern hemisphere,BIn the southern hemisphere. This is only one of the cases. As for other cases, it can be calculated using the same method. It is just the same. Of course, there are other special cases that you can't forget.

Assume that the ball is a pointO, Then the final result isBytesAOBRadians multiplied by the radius of the ballRThat is, the obtained spherical distance.

Set the straight line between the pole of the South Pole and the North Pole passing through the ballL, Vertices respectivelyB,AWorkLAnd set the vertical pointsD,C.

VerticesCProduction LineBDParallel lineBWorkCDParallel lines, the two parallel lines must be intersection, set the intersection point to E, it is easy to proveBdceIs a rectangle.

BecauseA,BPoint longitude and latitude are known, soBytesOBDAndBytesOACAlso known, setβ,α, Because of the radiusRKnown, so |BD| =R* Cosβ, |AC| =R* Cosα, |Od| =R* Sinβ, |OC| =R* Sinα.

PointsA,BThe longitude of is known, so it is not difficult to findBytesAce. Therefore, trianglesAceIt is not difficult to use the cosine theorem to find the value of | AE |.

Right TriangleAbeMedium, easy to findAB. TriangleAOBAll three edges are known, soBytesAOBYou can also use the cosine theorem.ABThe Sphere distance is also solved.

 

Haha, it's still a little difficult to do the three-dimensional ry I learned next semester. I wanted to write the code by the way today. Forget it. It's too late. Write it again tomorrow.

Sleep, suddenly!

 

(To be continued)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.