How the distance between points is calculated. Distance between two points on a plane. Coordinate systems. Division of a segment in this relation

Calculating distances between points based on their coordinates on a plane is elementary; on the Earth’s surface it is a little more complicated: we will consider measuring the distance and initial azimuth between points without projection transformations. First, let's understand the terminology.

Introduction

Great circle arc length– the shortest distance between any two points located on the surface of a sphere, measured along the line connecting these two points (such a line is called orthodromy) and passing along the surface of the sphere or other surface of revolution. Spherical geometry is different from normal Euclidean geometry and the distance equations also take a different form. In Euclidean geometry, the shortest distance between two points is a straight line. On a sphere, there are no straight lines. These lines on the sphere are part of great circles - circles whose centers coincide with the center of the sphere. Initial azimuth- azimuth, taking which when starting to move from point A, following a great circle for the shortest distance to point B, the end point will be point B. When moving from point A to point B along the great circle line, the azimuth from the current position to the end point B is constant is changing. The initial azimuth is different from a constant one, following which the azimuth from the current point to the final point does not change, but the route followed is not the shortest distance between two points.

Through any two points on the surface of a sphere, if they are not directly opposite to each other (that is, they are not antipodes), a unique great circle can be drawn. Two points divide a large circle into two arcs. The length of a short arc is the shortest distance between two points. An infinite number of large circles can be drawn between two antipodal points, but the distance between them will be the same on any circle and equal to half the circumference of the circle, or π*R, where R is the radius of the sphere.

On a plane (in a rectangular coordinate system), large circles and their fragments, as mentioned above, represent arcs in all projections except the gnomonic one, where large circles are straight lines. In practice, this means that airplanes and other air transport always use the route of the minimum distance between points to save fuel, that is, the flight is carried out along a great circle distance, on a plane it looks like an arc.

The shape of the Earth can be described as a sphere, so great circle distance equations are important for calculating the shortest distance between points on the Earth's surface and are often used in navigation. Calculating distance by this method is more efficient and in many cases more accurate than calculating it for projected coordinates (in rectangular coordinate systems), since, firstly, it does not require translation geographical coordinates into a rectangular coordinate system (carry out projection transformations) and, secondly, many projections, if incorrectly selected, can lead to significant length distortions due to the characteristics of projection distortions. It is known that it is not a sphere, but an ellipsoid that describes the shape of the Earth more accurately, however, this article discusses the calculation of distances specifically on a sphere; for calculations, a sphere with a radius of 6,372,795 meters is used, which can lead to an error in calculating distances of the order of 0.5%.

Formulas

There are three ways to calculate the great circle spherical distance. 1. Spherical cosine theorem In the case of small distances and small calculation depth (number of decimal places), the use of the formula can lead to significant rounding errors. φ1, λ1; φ2, λ2 - latitude and longitude of two points in radians Δλ - difference in coordinates in longitude Δδ - angular difference Δδ = arccos (sin φ1 sin φ2 + cos φ1 cos φ2 cos Δλ) To convert the angular distance to metric, you need to multiply the angular difference by the radius Earth (6372795 meters), the units of the final distance will be equal to the units in which the radius is expressed (in in this case- meters). 2. Haversine formula Used to avoid problems with short distances. 3. Modification for the antipodes The previous formula is also subject to the problem of antipodal points; to solve it, the following modification is used.

My implementation on PHP

// Earth radius define("EARTH_RADIUS", 6372795); /* * Distance between two points * $φA, $λA - latitude, longitude of the 1st point, * $φB, $λB - latitude, longitude of the 2nd point * Written based on http://gis-lab.info/ qa/great-circles.html * Mikhail Kobzarev< >* */ function calculateTheDistance ($φA, $λA, $φB, $λB) ( // convert coordinates to radians $lat1 = $φA * M_PI / 180; $lat2 = $φB * M_PI / 180; $long1 = $λA * M_PI / 180; $long2 = $λB * M_PI / 180; // cosines and sines of latitudes and longitudes $cl1 = cos($lat1); ; $sl2 = sin($lat2); $delta = $long2 - $long1; $cdelta = cos($delta); $sdelta = sin($delta); $cl2 * $sdelta, 2) + pow($cl1 * $sl2 - $sl1 * $cl2 * $cdelta, 2)); $x = $sl1 * $sl2 + $cl1 * $cl2 * $cdelta; $ad = atan2($y, $x); $dist = $ad * EARTH_RADIUS; return $dist; Example of a function call: $lat1 = 77.1539; $long1 = -139.398; $lat2 = -77.1804; $long2 = -139.55; echo calculateTheDistance($lat1, $long1, $lat2, $long2) . "meters"; // Return "17166029 meters"

Article taken from the site

There will be a calculator here

Distance between two points on a line

Consider a coordinate line on which 2 points are marked: A A A And B B B. To find the distance between these points, you need to find the length of the segment A B AB A B. This is done using the following formula:

Distance between two points on a line

A B = ∣ a − b ∣ AB=|a-b|A B =∣a−b∣,

Where a , b a, b a, b- coordinates of these points on a straight line (coordinate line).

Due to the fact that the formula contains a modulus, when solving it is not important which coordinate to subtract from which (since we take absolute value this difference).

∣ a − b ∣ = ∣ b − a ∣ |a-b|=|b-a|∣a−b ∣ =∣ b −a∣

Let's look at an example to better understand the solution to such problems.

Example 1

Points are marked on the coordinate line A A A, whose coordinate is equal to 9 9 9 and period B B B with coordinate − 1 -1 − 1 . We need to find the distance between these two points.

Solution

Here a = 9 , b = − 1 a=9, b=-1 a =9 , b =− 1

We use the formula and substitute the values:

A B = ∣ a − b ∣ = ∣ 9 − (− 1) ∣ = ∣ 10 ∣ = 10 AB=|a-b|=|9-(-1)|=|10|=10A B =∣a−b ∣ =∣ 9 − (− 1 ) ∣ = ∣ 1 0 ∣ = 1 0

Answer

Distance between two points on a plane

Consider two points given on a plane. From each point marked on the plane, you need to lower two perpendiculars: To the axis O X OX O X and on the axle O Y OY O Y. Then the triangle is considered A B C ABC A B C. Since it is rectangular ( B C BC B C perpendicular A C AC A C), then find the segment A B AB A B, which is also the distance between points, can be done using the Pythagorean theorem. We have:

A B 2 = A C 2 + B C 2 AB^2=AC^2+BC^2A B 2 = A C 2 + B C 2

But, based on the fact that the length A C AC A C equal to x B − x A x_B-x_A x Bx A, and the length B C BC B C equal to y B − y A y_B-y_A y By A, this formula can be rewritten as follows:

Distance between two points on a plane

A B = (x B − x A) 2 + (y B − y A) 2 AB=\sqrt((x_B-x_A)^2+(y_B-y_A)^2)A B =(x Bx A) 2 + (y By A) 2 ,

Where x A , y A x_A, y_A x A, y A And x B , y B x_B, y_B x B, y B- coordinates of points A A A And B B B respectively.

Example 2

It is necessary to find the distance between points C C C And F F F, if the coordinates of the first (8 ; − 1) (8;-1) (8 ; − 1 ) , and second - (4 ; 2) (4;2) (4 ; 2 ) .

Solution

X C = 8 x_C=8 x C= 8
y C = − 1 y_C=-1 y C= − 1
x F = 4 x_F=4 x F= 4
y F = 2 y_F=2 y F= 2

C F = (x F − x C) 2 + (y F − y C) 2 = (4 − 8) 2 + (2 − (− 1)) 2 = 16 + 9 = 25 = 5 CF=\sqrt(( x_F-x_C)^2+(y_F-y_C)^2)=\sqrt((4-8)^2+(2-(-1))^2)=\sqrt(16+9)=\sqrt( 25)=5C F =(x Fx C) 2 + (y Fy C) 2 = (4 − 8 ) 2 + (2 − (− 1 ) ) 2 = 1 6 + 9 = 2 5 ​ = 5

Answer

Distance between two points in space

Finding the distance between two points in this case is similar to the previous one, except that the coordinates of the point in space are specified by three numbers; accordingly, the coordinate of the applicate axis must also be added to the formula. The formula will look like this:

Distance between two points in space

A B = (x B − x A) 2 + (y B − y A) 2 + (z B − z A) 2 AB=\sqrt((x_B-x_A)^2+(y_B-y_A)^2+( z_B-z_A)^2)A B =(x Bx A) 2 + (y By A) 2 + (z B zA ) 2

Example 3

Find the length of the segment FK FK

Solution

F = (− 1 ; − 1 ; 8) F=(-1;-1;8)

F K = (x K − x F) 2 + (y K − y F) 2 + (z K − z F) 2 = (− 3 − (− 1)) 2 + (6 − (− 1)) 2 + (0 − 8) 2 = 117 ≈ 10.8 FK=\sqrt((x_K-x_F)^2+(y_K-y_F)^2+(z_K-z_F)^2)=\sqrt((-3-(-1 ))^2+(6-(-1))^2+(0-8)^2)=\sqrt(117)\approx10.8

According to the conditions of the problem, we need to round the answer to a whole number.

The distance between two points on a plane.
Coordinate systems

Each point A of the plane is characterized by its coordinates (x, y). They coincide with the coordinates of the vector 0A coming out from point 0 - the origin of coordinates.

Let A and B be arbitrary points of the plane with coordinates (x 1 y 1) and (x 2, y 2), respectively.

Then the vector AB obviously has coordinates (x 2 - x 1, y 2 - y 1). It is known that the square of the vector length equal to the sum squares of its coordinates. Therefore, the distance d between points A and B, or, what is the same, the length of the vector AB, is determined from the condition

d 2 = (x 2 - x 1) 2 + (y 2 - y 1) 2.

d = \/ (x 2 - x 1) 2 + (y 2 - y 1) 2

The resulting formula allows you to find the distance between any two points on the plane, if only the coordinates of these points are known

Every time we talk about the coordinates of a particular point on the plane, we mean a well-defined coordinate system x0y. In general, the coordinate system on a plane can be chosen in different ways. So, instead of the x0y coordinate system, you can consider the x"0y" coordinate system, which is obtained by rotating the old coordinate axes around the starting point 0 counter-clockwise arrows on the corner α .

If some point of the plane in the x0y coordinate system had coordinates (x, y), then in new system coordinates x"0y" it will have different coordinates (x", y").

As an example, consider point M, located on the 0x-axis and separated from point 0 at a distance of 1.

Obviously, in the x0y coordinate system this point has coordinates (cos α ,sin α ), and in the x"0y" coordinate system the coordinates are (1,0).

The coordinates of any two points on the plane A and B depend on how the coordinate system is specified in this plane. But the distance between these points does not depend on the method of specifying the coordinate system. We will make significant use of this important circumstance in the next paragraph.

Exercises

I. Find the distances between points of the plane with coordinates:

1) (3.5) and (3.4); 3) (0.5) and (5, 0); 5) (-3,4) and (9, -17);

2) (2, 1) and (- 5, 1); 4) (0, 7) and (3,3); 6) (8, 21) and (1, -3).

II. Find the perimeter of a triangle whose sides are given by the equations:

x + y - 1 = 0, 2x - y - 2 = 0 and y = 1.

III. In the x0y coordinate system, points M and N have coordinates (1, 0) and (0,1), respectively. Find the coordinates of these points in the new coordinate system, which is obtained by rotating the old axes around the starting point by an angle of 30° counterclockwise.

IV. In the x0y coordinate system, points M and N have coordinates (2, 0) and (\ / 3/2, - 1/2) respectively. Find the coordinates of these points in the new coordinate system, which is obtained by rotating the old axes around the starting point by an angle of 30° clockwise.

Each point A of the plane is characterized by its coordinates (x, y). They coincide with the coordinates of the vector 0A coming out from point 0 - the origin of coordinates.

Let A and B be arbitrary points of the plane with coordinates (x 1 y 1) and (x 2, y 2), respectively.

Then the vector AB obviously has coordinates (x 2 - x 1, y 2 - y 1). It is known that the square of the length of a vector is equal to the sum of the squares of its coordinates. Therefore, the distance d between points A and B, or, what is the same, the length of the vector AB, is determined from the condition

d 2 = (x 2 - x 1) 2 + (y 2 - y 1) 2.

$$ d = \sqrt((x_2 - x_1)^2 + (y_2 - y_1)^2) $$

The resulting formula allows you to find the distance between any two points on the plane, if only the coordinates of these points are known

Every time we talk about the coordinates of a particular point on the plane, we mean a well-defined coordinate system x0y. In general, the coordinate system on a plane can be chosen in different ways. So, instead of the coordinate system x0y, we can consider the coordinate system xִy, which is obtained as a result of rotating the old coordinate axes around the starting point 0 counter-clockwise arrows on the corner α .

If a certain point of the plane in the coordinate system x0y had coordinates (x, y), then in the new coordinate system xִy it will have different coordinates (x, y).

As an example, consider point M, located on the 0x axis and separated from point 0 at a distance of 1.

Obviously, in the x0y coordinate system this point has coordinates (cos α ,sin α ), and in the xִy coordinate system the coordinates are (1,0).

The coordinates of any two points on the plane A and B depend on how the coordinate system is specified in this plane. And here the distance between these points does not depend on the method of specifying the coordinate system .

Other materials

In this article we will look at ways to determine the distance from point to point theoretically and using the example of specific tasks. To begin with, let's introduce some definitions.

Definition 1

Distance between points is the length of the segment connecting them, on the existing scale. It is necessary to set a scale in order to have a unit of length for measurement. Therefore, basically the problem of finding the distance between points is solved by using their coordinates on a coordinate line, in a coordinate plane or three-dimensional space.

Initial data: coordinate line O x and an arbitrary point A lying on it. Any point on the line has one characteristic real number: let for point A this be a certain number x A, it is also the coordinate of point A.

In general, we can say that the length of a certain segment is assessed in comparison with a segment taken as a unit of length on a given scale.

If point A corresponds to an integer real number, by laying off sequentially from point O to point along the straight line O A segments - units of length, we can determine the length of the segment O A from the total number of set aside unit segments.

For example, point A corresponds to the number 3 - to get to it from point O, you will need to lay off three unit segments. If point A has coordinate - 4, unit segments are laid out in a similar way, but in a different, negative direction. Thus, in the first case, the distance O A is equal to 3; in the second case O A = 4.

If point A has as its coordinate rational number, then from the origin (point O) we set aside an integer number of unit segments, and then its necessary part. But geometrically it is not always possible to make a measurement. For example, it seems difficult to plot the fraction 4 111 on the coordinate line.

Using the above method, put it on a straight line irrational number and completely impossible. For example, when the coordinate of point A is 11. In this case, it is possible to turn to abstraction: if the given coordinate of point A is greater than zero, then O A = x A (the number is taken as the distance); if the coordinate is less than zero, then O A = - x A . In general, these statements are true for any real number x A.

To summarize: the distance from the origin to the point that corresponds to a real number on the coordinate line is equal to:

  • 0 if the point coincides with the origin;
  • x A, if x A > 0;
  • - x A if x A< 0 .

In this case, it is obvious that the length of the segment itself cannot be negative, therefore, using the modulus sign, we write the distance from point O to point A with the coordinate xA: O A = x A

The following statement will be true: the distance from one point to another will be equal to the modulus of the coordinate difference. Those. for points A and B lying on the same coordinate line for any location and having corresponding coordinates xA And x B: A B = x B - x A .

Initial data: points A and B lying on a plane in a rectangular coordinate system O x y with given coordinates: A (x A, y A) and B (x B, y B).

Let us draw perpendiculars through points A and B to the coordinate axes O x and O y and obtain as a result the projection points: A x, A y, B x, B y. Based on the location of points A and B, the following options are then possible:

If points A and B coincide, then the distance between them is zero;

If points A and B lie on a straight line perpendicular to the O x axis (abscissa axis), then the points coincide, and | A B | = | A y B y | . Since the distance between the points is equal to the modulus of the difference of their coordinates, then A y B y = y B - y A, and, therefore, A B = A y B y = y B - y A.

If points A and B lie on a straight line perpendicular to the O y axis (ordinate axis) - by analogy with the previous paragraph: A B = A x B x = x B - x A

If points A and B do not lie on a straight line perpendicular to one of the coordinate axes, we will find the distance between them by deriving the calculation formula:

We see that triangle A B C is rectangular in construction. In this case, A C = A x B x and B C = A y B y. Using the Pythagorean theorem, we create the equality: A B 2 = A C 2 + B C 2 ⇔ A B 2 = A x B x 2 + A y B y 2 , and then transform it: A B = A x B x 2 + A y B y 2 = x B - x A 2 + y B - y A 2 = (x B - x A) 2 + (y B - y A) 2

Let's draw a conclusion from the result obtained: the distance from point A to point B on the plane is determined by calculation using the formula using the coordinates of these points

A B = (x B - x A) 2 + (y B - y A) 2

The resulting formula also confirms previously formed statements for cases of coincidence of points or situations when the points lie on straight lines perpendicular to the axes. So, if points A and B coincide, the following equality will be true: A B = (x B - x A) 2 + (y B - y A) 2 = 0 2 + 0 2 = 0

For a situation where points A and B lie on a straight line perpendicular to the x-axis:

A B = (x B - x A) 2 + (y B - y A) 2 = 0 2 + (y B - y A) 2 = y B - y A

For the case when points A and B lie on a straight line perpendicular to the ordinate axis:

A B = (x B - x A) 2 + (y B - y A) 2 = (x B - x A) 2 + 0 2 = x B - x A

Initial data: a rectangular coordinate system O x y z with arbitrary points lying on it with given coordinates A (x A, y A, z A) and B (x B, y B, z B). It is necessary to determine the distance between these points.

Let us consider the general case when points A and B do not lie in a plane parallel to one of coordinate planes. Let us draw planes perpendicular to the coordinate axes through points A and B and obtain the corresponding projection points: A x , A y , A z , B x , B y , B z

The distance between points A and B is the diagonal of the resulting parallelepiped. According to the construction of the measurements of this parallelepiped: A x B x , A y B y and A z B z

From the geometry course we know that the square of the diagonal of a parallelepiped is equal to the sum of the squares of its dimensions. Based on this statement, we obtain the equality: A B 2 = A x B x 2 + A y B y 2 + A z B z 2

Using the conclusions obtained earlier, we write the following:

A x B x = x B - x A , A y B y = y B - y A , A z B z = z B - z A

Let's transform the expression:

A B 2 = A x B x 2 + A y B y 2 + A z B z 2 = x B - x A 2 + y B - y A 2 + z B - z A 2 = = (x B - x A) 2 + (y B - y A) 2 + z B - z A 2

Final formula for determining the distance between points in space will look like this:

A B = x B - x A 2 + y B - y A 2 + (z B - z A) 2

The resulting formula is also valid for cases when:

The points coincide;

They lie on one coordinate axis or a straight line parallel to one of the coordinate axes.

Examples of solving problems on finding the distance between points

Example 1

Initial data: a coordinate line and points lying on it with given coordinates A (1 - 2) and B (11 + 2) are given. It is necessary to find the distance from the origin point O to point A and between points A and B.

Solution

  1. The distance from the reference point to the point is equal to the modulus of the coordinate of this point, respectively O A = 1 - 2 = 2 - 1
  2. We define the distance between points A and B as the modulus of the difference between the coordinates of these points: A B = 11 + 2 - (1 - 2) = 10 + 2 2

Answer: O A = 2 - 1, A B = 10 + 2 2

Example 2

Initial data: a rectangular coordinate system and two points lying on it A (1, - 1) and B (λ + 1, 3) are given. λ is some real number. It is necessary to find all values ​​of this number at which the distance A B will be equal to 5.

Solution

To find the distance between points A and B, you must use the formula A B = (x B - x A) 2 + y B - y A 2

Substituting the real coordinate values, we get: A B = (λ + 1 - 1) 2 + (3 - (- 1)) 2 = λ 2 + 16

We also use the existing condition that A B = 5 and then the equality will be true:

λ 2 + 16 = 5 λ 2 + 16 = 25 λ = ± 3

Answer: A B = 5 if λ = ± 3.

Example 3

Initial data: specified three-dimensional space in a rectangular coordinate system O x y z and the points A (1, 2, 3) and B - 7, - 2, 4 lying in it.

Solution

To solve the problem, we use the formula A B = x B - x A 2 + y B - y A 2 + (z B - z A) 2

Substituting real values, we get: A B = (- 7 - 1) 2 + (- 2 - 2) 2 + (4 - 3) 2 = 81 = 9

Answer: | A B | = 9

If you notice an error in the text, please highlight it and press Ctrl+Enter