The equation of a line passing through a given point in a given direction. Equation of a line passing through two given points. The angle between two straight lines. The condition of parallelism and perpendicularity of two straight lines. Determining the point of intersection of two lines

1. Equation of a line passing through a given point A(x 1 , y 1) in a given direction, determined by the slope k,

y - y 1 = k(x - x 1). (1)

This equation defines a pencil of lines passing through a point A(x 1 , y 1), which is called the beam center.

2. Equation of a line passing through two points: A(x 1 , y 1) and B(x 2 , y 2), written like this:

The angular coefficient of a straight line passing through two given points is determined by the formula

3. Angle between straight lines A And B is the angle by which the first straight line must be rotated A around the point of intersection of these lines counterclockwise until it coincides with the second line B. If two straight lines are given by equations with a slope

y = k 1 x + B 1 ,

The line passing through the point K(x 0 ; y 0) and parallel to the line y = kx + a is found by the formula:

y - y 0 = k(x - x 0) (1)

Where k is the slope of the line.

Alternative formula:
A line passing through the point M 1 (x 1 ; y 1) and parallel to the line Ax+By+C=0 is represented by the equation

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

Write an equation for a line passing through point K( ;) parallel to the straight line y = x+ .
Example No. 1. Write an equation for a straight line passing through the point M 0 (-2,1) and at the same time:
a) parallel to the straight line 2x+3y -7 = 0;
b) perpendicular to the straight line 2x+3y -7 = 0.
Solution . Let's imagine the equation with the slope in the form y = kx + a. To do this, move all values ​​except y to the right side: 3y = -2x + 7 . Then divide the right-hand side by a factor of 3. We get: y = -2/3x + 7/3
Let's find the equation NK passing through the point K(-2;1), parallel to the straight line y = -2 / 3 x + 7 / 3
Substituting x 0 = -2, k = -2 / 3, y 0 = 1 we get:
y-1 = -2 / 3 (x-(-2))
or
y = -2 / 3 x - 1 / 3 or 3y + 2x +1 = 0

Example No. 2. Write the equation of a line parallel to the line 2x + 5y = 0 and forming, together with the coordinate axes, a triangle whose area is 5.
Solution . Since the lines are parallel, the equation of the desired line is 2x + 5y + C = 0. Area right triangle, where a and b are its legs. Let's find the intersection points of the desired line with the coordinate axes:
;
.
So, A(-C/2,0), B(0,-C/5). Let's substitute it into the formula for area: . We get two solutions: 2x + 5y + 10 = 0 and 2x + 5y – 10 = 0.

Example No. 3. Write an equation for a line passing through the point (-2; 5) and parallel to the line 5x-7y-4=0.
Solution. This straight line can be represented by the equation y = 5 / 7 x – 4 / 7 (here a = 5 / 7). The equation of the desired line is y – 5 = 5 / 7 (x – (-2)), i.e. 7(y-5)=5(x+2) or 5x-7y+45=0 .

Example No. 4. Having solved example 3 (A=5, B=-7) using formula (2), we find 5(x+2)-7(y-5)=0.

Example No. 5. Write an equation for a line passing through the point (-2;5) and parallel to the line 7x+10=0.
Solution. Here A=7, B=0. Formula (2) gives 7(x+2)=0, i.e. x+2=0. Formula (1) is not applicable, since given equation cannot be resolved relative to y (this line is parallel to the ordinate).

General equation of a straight line:

Special cases general equation straight:

and if C= 0, equation (2) will have the form

Ax + By = 0,

and the straight line defined by this equation passes through the origin, since the coordinates of the origin are x = 0, y= 0 satisfy this equation.

b) If in the general equation of the straight line (2) B= 0, then the equation takes the form

Ax + WITH= 0, or .

The equation does not contain a variable y, and the straight line defined by this equation is parallel to the axis Oy.

c) If in the general equation of the straight line (2) A= 0, then this equation will take the form

By + WITH= 0, or ;

the equation does not contain a variable x, and the straight line it defines is parallel to the axis Ox.

Remember: if a line is parallel to any coordinate axis, then in its equation there is no term containing a coordinate of the same name as this axis.

d) When C= 0 and A= 0 equation (2) takes the form By= 0, or y = 0.

This is the equation of the axis Ox.

d) When C= 0 and B= 0 equation (2) will be written in the form Ax= 0 or x = 0.

This is the equation of the axis Oy.

The relative position of lines on a plane. The angle between straight lines on a plane. Condition for parallel lines. The condition of perpendicularity of lines.

l 1 l 2 l 1: A 1 x + B 1 y + C 1 = 0
l 2: A 2 x + B 2 y + C 2 = 0

S 2 S 1 Vectors S 1 and S 2 are called guides for their lines.

The angle between straight lines l 1 and l 2 is determined by the angle between the direction vectors.
Theorem 1: cos of the angle between l 1 and l 2 = cos(l 1 ; l 2) =

Theorem 2: In order for 2 lines to be equal it is necessary and sufficient:

Theorem 3: For 2 straight lines to be perpendicular it is necessary and sufficient:

L 1 l 2 ó A 1 A 2 + B 1 B 2 = 0


General plane equation and its special cases. Equation of a plane in segments.

General plane equation:

Ax + By + Cz + D = 0

Special cases:

1. D=0 Ax+By+Cz = 0 – the plane passes through the origin

2. С=0 Ax+By+D = 0 – plane || OZ

3. B=0 Ax+Cz+d = 0 – plane || OY

4. A=0 By+Cz+D = 0 – plane || OX

5. A=0 and D=0 By+Cz = 0 – the plane passes through OX

6. B=0 and D=0 Ax+Cz = 0 – the plane passes through OY

7. C=0 and D=0 Ax+By = 0 – the plane passes through OZ

The relative position of planes and straight lines in space:

1. The angle between straight lines in space is the angle between their direction vectors.

Cos (l 1 ; l 2) = cos(S 1 ; S 2) = =

2. The angle between the planes is determined through the angle between their normal vectors.

Cos (l 1 ; l 2) = cos(N 1 ; N 2) = =

3. The cosine of the angle between the line and the plane can be found through the sin of the angle between the direction vector of the line and the normal vector of the plane.

4. 2 straight || in space when their || vector guides

5. 2 planes || when || normal vectors

6. The concepts of perpendicularity of lines and planes are introduced similarly.


Question No. 14

Different kinds equations of a straight line on a plane (equation of a straight line in segments, with an angle coefficient, etc.)

Equation of a straight line in segments:
Let us assume that in the general equation of the straight line:

1. C = 0 Ах + Ву = 0 – the straight line passes through the origin.

2. a = 0 Vu + C = 0 y =

3. b = 0 Ax + C = 0 x =

4. b=C=0 Ax = 0 x = 0

5. a=C=0 Ву = 0 у = 0

Equation of a straight line with a slope:

Any straight line that is not equal to the op-amp axis (B not = 0) can be written down in the next line. form:

k = tanα α – angle between straight line and positively directed line OX

b – point of intersection of the straight line with the axis of the op-amp

Document:

Ax+By+C = 0

Wu= -Ah-S |:B

Equation of a straight line based on two points:


Question No. 16

Finite limit of a function at a point and for x→∞

End limit at x0:

The number A is called the limit of the function y = f(x) for x→x 0 if for any E > 0 there exists b > 0 such that for x ≠x 0 satisfying the inequality |x – x 0 |< б, выполняется условие |f(x) - A| < Е

The limit is indicated by: = A

End limit at point +∞:

The number A is called the limit of the function y = f(x) at x → + ∞ , if for any E > 0 there exists C > 0 such that for x > C the inequality |f(x) - A|< Е

The limit is indicated by: = A

End limit at point -∞:

The number A is called the limit of the function y = f(x) for x→-∞, if for any E< 0 существует С < 0 такое, что при х < -С выполняется неравенство |f(x) - A| < Е

This article continues the topic of the equation of a line on a plane: we will consider this type of equation as the general equation of a line. Let us define the theorem and give its proof; Let's figure out what an incomplete general equation of a line is and how to make transitions from a general equation to other types of equations of a line. We will reinforce the entire theory with illustrations and solutions to practical problems.

Yandex.RTB R-A-339285-1

Let a rectangular coordinate system O x y be specified on the plane.

Theorem 1

Any equation of the first degree, having the form A x + B y + C = 0, where A, B, C are some real numbers (A and B are not equal to zero at the same time), defines a straight line in a rectangular coordinate system on a plane. In turn, any straight line in a rectangular coordinate system on a plane is determined by an equation that has the form A x + B y + C = 0 for a certain set of values ​​A, B, C.

Proof

This theorem consists of two points; we will prove each of them.

  1. Let us prove that the equation A x + B y + C = 0 defines a straight line on the plane.

Let there be some point M 0 (x 0 , y 0) whose coordinates correspond to the equation A x + B y + C = 0. Thus: A x 0 + B y 0 + C = 0. Subtract from the left and right sides of the equations A x + B y + C = 0 the left and right sides of the equation A x 0 + B y 0 + C = 0, we obtain a new equation that looks like A (x - x 0) + B (y - y 0) = 0 . It is equivalent to A x + B y + C = 0.

The resulting equation A (x - x 0) + B (y - y 0) = 0 is a necessary and sufficient condition for the perpendicularity of the vectors n → = (A, B) and M 0 M → = (x - x 0, y - y 0 ) . Thus, the set of points M (x, y) defines a straight line in a rectangular coordinate system perpendicular to the direction of the vector n → = (A, B). We can assume that this is not so, but then the vectors n → = (A, B) and M 0 M → = (x - x 0, y - y 0) would not be perpendicular, and the equality A (x - x 0 ) + B (y - y 0) = 0 would not be true.

Consequently, the equation A (x - x 0) + B (y - y 0) = 0 defines a certain line in a rectangular coordinate system on the plane, and therefore the equivalent equation A x + B y + C = 0 defines the same line. This is how we proved the first part of the theorem.

  1. Let us provide a proof that any straight line in a rectangular coordinate system on a plane can be specified by an equation of the first degree A x + B y + C = 0.

Let us define a straight line a in a rectangular coordinate system on a plane; the point M 0 (x 0 , y 0) through which this line passes, as well as the normal vector of this line n → = (A, B) .

Let there also be some point M (x, y) - a floating point on a line. In this case, the vectors n → = (A, B) and M 0 M → = (x - x 0, y - y 0) are perpendicular to each other, and their scalar product there is a zero:

n → , M 0 M → = A (x - x 0) + B (y - y 0) = 0

Let's rewrite the equation A x + B y - A x 0 - B y 0 = 0, define C: C = - A x 0 - B y 0 and as a final result we get the equation A x + B y + C = 0.

So, we have proved the second part of the theorem, and we have proved the entire theorem as a whole.

Definition 1

An equation of the form A x + B y + C = 0 - This general equation of a line on a plane in a rectangular coordinate systemOxy.

Based on the proven theorem, we can conclude that a straight line and its general equation defined on a plane in a fixed rectangular coordinate system are inextricably linked. In other words, the original line corresponds to its general equation; the general equation of a line corresponds to a given line.

From the proof of the theorem it also follows that the coefficients A and B for the variables x and y are the coordinates of the normal vector of the line, which is given by the general equation of the line A x + B y + C = 0.

Let's consider specific example general equation of a straight line.

Let the equation 2 x + 3 y - 2 = 0 be given, which corresponds to a straight line in a given rectangular coordinate system. The normal vector of this line is the vector n → = (2 , 3) ​​. Let's draw the given straight line in the drawing.

We can also state the following: the straight line that we see in the drawing is determined by the general equation 2 x + 3 y - 2 = 0, since the coordinates of all points on a given straight line correspond to this equation.

We can obtain the equation λ · A x + λ · B y + λ · C = 0 by multiplying both sides of the general equation of the line by a number λ not equal to zero. The resulting equation is equivalent to the original general equation, therefore, it will describe the same straight line on the plane.

Definition 2

Complete general equation of a line– such a general equation of the straight line A x + B y + C = 0, in which the numbers A, B, C are different from zero. Otherwise the equation is incomplete.

Let us analyze all variations of the incomplete general equation of a line.

  1. When A = 0, B ≠ 0, C ≠ 0, the general equation takes the form B y + C = 0. Such an incomplete general equation defines in a rectangular coordinate system O x y a straight line that is parallel to the O x axis, since for any real value of x the variable y will take the value - C B . In other words, the general equation of the straight line A x + B y + C = 0, when A = 0, B ≠ 0, specifies the locus of points (x, y), whose coordinates are equal to the same number - C B .
  2. If A = 0, B ≠ 0, C = 0, the general equation takes the form y = 0. This incomplete equation defines the x-axis O x .
  3. When A ≠ 0, B = 0, C ≠ 0, we obtain an incomplete general equation A x + C = 0, defining a straight line parallel to the ordinate.
  4. Let A ≠ 0, B = 0, C = 0, then the incomplete general equation will take the form x = 0, and this is the equation of the coordinate line O y.
  5. Finally, for A ≠ 0, B ≠ 0, C = 0, the incomplete general equation takes the form A x + B y = 0. And this equation describes a straight line that passes through the origin. In fact, the pair of numbers (0, 0) corresponds to the equality A x + B y = 0, since A · 0 + B · 0 = 0.

Let us graphically illustrate all of the above types of incomplete general equation of a straight line.

Example 1

It is known that the given straight line is parallel to the ordinate axis and passes through the point 2 7, - 11. It is necessary to write down the general equation of the given line.

Solution

A straight line parallel to the ordinate axis is given by an equation of the form A x + C = 0, in which A ≠ 0. The condition also specifies the coordinates of the point through which the line passes, and the coordinates of this point meet the conditions of the incomplete general equation A x + C = 0, i.e. the equality is true:

A 2 7 + C = 0

From it it is possible to determine C if we give A some non-zero value, for example, A = 7. In this case, we get: 7 · 2 7 + C = 0 ⇔ C = - 2. We know both coefficients A and C, substitute them into the equation A x + C = 0 and get the required straight line equation: 7 x - 2 = 0

Answer: 7 x - 2 = 0

Example 2

The drawing shows a straight line; you need to write down its equation.

Solution

The given drawing allows us to easily take the initial data to solve the problem. We see in the drawing that the given straight line is parallel to the O x axis and passes through the point (0, 3).

The straight line, which is parallel to the abscissa, is determined by the incomplete general equation B y + C = 0. Let's find the values ​​of B and C. The coordinates of the point (0, 3), since the given line passes through it, will satisfy the equation of the line B y + C = 0, then the equality is valid: B · 3 + C = 0. Let's set B to some value other than zero. Let's say B = 1, in which case from the equality B · 3 + C = 0 we can find C: C = - 3. We use known values B and C, we obtain the required equation of the straight line: y - 3 = 0.

Answer: y - 3 = 0 .

General equation of a line passing through a given point in a plane

Let the given line pass through the point M 0 (x 0 , y 0), then its coordinates correspond to the general equation of the line, i.e. the equality is true: A x 0 + B y 0 + C = 0. Let us subtract the left and right sides of this equation from the left and right sides of the general complete equation straight. We get: A (x - x 0) + B (y - y 0) + C = 0, this equation is equivalent to the original general one, passes through the point M 0 (x 0, y 0) and has a normal vector n → = (A, B) .

The result that we obtained makes it possible to write down the general equation of a line with known coordinates of the normal vector of the line and the coordinates of a certain point of this line.

Example 3

Given a point M 0 (- 3, 4) through which a line passes, and the normal vector of this line n → = (1 , - 2) . It is necessary to write down the equation of the given line.

Solution

The initial conditions allow us to obtain the necessary data to compile the equation: A = 1, B = - 2, x 0 = - 3, y 0 = 4. Then:

A (x - x 0) + B (y - y 0) = 0 ⇔ 1 (x - (- 3)) - 2 y (y - 4) = 0 ⇔ ⇔ x - 2 y + 22 = 0

The problem could have been solved differently. The general equation of a straight line is A x + B y + C = 0. The given normal vector allows us to obtain the values ​​of coefficients A and B, then:

A x + B y + C = 0 ⇔ 1 x - 2 y + C = 0 ⇔ x - 2 y + C = 0

Now let’s find the value of C using the point M 0 (- 3, 4) specified by the condition of the problem, through which the straight line passes. The coordinates of this point correspond to the equation x - 2 · y + C = 0, i.e. - 3 - 2 4 + C = 0. Hence C = 11. The required straight line equation takes the form: x - 2 · y + 11 = 0.

Answer: x - 2 y + 11 = 0 .

Example 4

Given a line 2 3 x - y - 1 2 = 0 and a point M 0 lying on this line. Only the abscissa of this point is known, and it is equal to - 3. It is necessary to determine the ordinate of a given point.

Solution

Let us designate the coordinates of point M 0 as x 0 and y 0 . The source data indicates that x 0 = - 3. Since the point belongs to a given line, then its coordinates correspond to the general equation of this line. Then the equality will be true:

2 3 x 0 - y 0 - 1 2 = 0

Define y 0: 2 3 · (- 3) - y 0 - 1 2 = 0 ⇔ - 5 2 - y 0 = 0 ⇔ y 0 = - 5 2

Answer: - 5 2

Transition from the general equation of a line to other types of equations of a line and vice versa

As we know, there are several types of equations for the same straight line on a plane. The choice of the type of equation depends on the conditions of the problem; it is possible to choose the one that is more convenient for solving it. The skill of converting an equation of one type into an equation of another type is very useful here.

First, let's consider the transition from the general equation of the form A x + B y + C = 0 to the canonical equation x - x 1 a x = y - y 1 a y.

If A ≠ 0, then we move the term B y to the right side of the general equation. On the left side we take A out of brackets. As a result, we get: A x + C A = - B y.

This equality can be written as a proportion: x + C A - B = y A.

If B ≠ 0, we leave only the term A x on the left side of the general equation, transfer the others to the right side, we get: A x = - B y - C. We take – B out of brackets, then: A x = - B y + C B .

Let's rewrite the equality in the form of a proportion: x - B = y + C B A.

Of course, there is no need to memorize the resulting formulas. It is enough to know the algorithm of actions when moving from a general equation to a canonical one.

Example 5

The general equation of the line 3 y - 4 = 0 is given. It is necessary to transform it into a canonical equation.

Solution

Let's write the original equation as 3 y - 4 = 0. Next, we proceed according to the algorithm: the term 0 x remains on the left side; and on the right side we put - 3 out of brackets; we get: 0 x = - 3 y - 4 3 .

Let's write the resulting equality as a proportion: x - 3 = y - 4 3 0 . Thus, we have obtained an equation of canonical form.

Answer: x - 3 = y - 4 3 0.

To transform the general equation of a line into parametric ones, first make the transition to the canonical form, and then the transition from canonical equation straight line to parametric equations.

Example 6

The straight line is given by the equation 2 x - 5 y - 1 = 0. Write down the parametric equations for this line.

Solution

Let us make the transition from the general equation to the canonical one:

2 x - 5 y - 1 = 0 ⇔ 2 x = 5 y + 1 ⇔ 2 x = 5 y + 1 5 ⇔ x 5 = y + 1 5 2

Now we take both sides of the resulting canonical equation equal to λ, then:

x 5 = λ y + 1 5 2 = λ ⇔ x = 5 λ y = - 1 5 + 2 λ , λ ∈ R

Answer:x = 5 λ y = - 1 5 + 2 λ , λ ∈ R

The general equation can be converted into an equation of a straight line with slope y = k · x + b, but only when B ≠ 0. For the transition, we leave the term B y on the left side, the rest are transferred to the right. We get: B y = - A x - C . Let's divide both sides of the resulting equality by B, different from zero: y = - A B x - C B.

Example 7

The general equation of the line is given: 2 x + 7 y = 0. You need to convert that equation into a slope equation.

Solution

Let's perform the necessary actions according to the algorithm:

2 x + 7 y = 0 ⇔ 7 y - 2 x ⇔ y = - 2 7 x

Answer: y = - 2 7 x .

From the general equation of a line, it is enough to simply obtain an equation in segments of the form x a + y b = 1. To make such a transition, we move the number C to the right side of the equality, divide both sides of the resulting equality by – C and, finally, transfer the coefficients for the variables x and y to the denominators:

A x + B y + C = 0 ⇔ A x + B y = - C ⇔ ⇔ A - C x + B - C y = 1 ⇔ x - C A + y - C B = 1

Example 8

It is necessary to transform the general equation of the line x - 7 y + 1 2 = 0 into the equation of the line in segments.

Solution

Let's move 1 2 to the right side: x - 7 y + 1 2 = 0 ⇔ x - 7 y = - 1 2 .

Let's divide both sides of the equality by -1/2: x - 7 y = - 1 2 ⇔ 1 - 1 2 x - 7 - 1 2 y = 1 .

Answer: x - 1 2 + y 1 14 = 1 .

In general, the reverse transition is also easy: from other types of equations to the general one.

The equation of a line in segments and an equation with an angular coefficient can be easily converted into a general one by simply collecting all the terms on the left side of the equality:

x a + y b ⇔ 1 a x + 1 b y - 1 = 0 ⇔ A x + B y + C = 0 y = k x + b ⇔ y - k x - b = 0 ⇔ A x + B y + C = 0

The canonical equation is converted to a general one according to the following scheme:

x - x 1 a x = y - y 1 a y ⇔ a y · (x - x 1) = a x (y - y 1) ⇔ ⇔ a y x - a x y - a y x 1 + a x y 1 = 0 ⇔ A x + B y + C = 0

To move from parametric ones, first move to the canonical one, and then to the general one:

x = x 1 + a x · λ y = y 1 + a y · λ ⇔ x - x 1 a x = y - y 1 a y ⇔ A x + B y + C = 0

Example 9

The parametric equations of the line x = - 1 + 2 · λ y = 4 are given. It is necessary to write down the general equation of this line.

Solution

Let us make the transition from parametric equations to canonical ones:

x = - 1 + 2 · λ y = 4 ⇔ x = - 1 + 2 · λ y = 4 + 0 · λ ⇔ λ = x + 1 2 λ = y - 4 0 ⇔ x + 1 2 = y - 4 0

Let's move from the canonical to the general:

x + 1 2 = y - 4 0 ⇔ 0 · (x + 1) = 2 (y - 4) ⇔ y - 4 = 0

Answer: y - 4 = 0

Example 10

The equation of a straight line in the segments x 3 + y 1 2 = 1 is given. It is necessary to make a transition to general appearance equations

Solution:

We simply rewrite the equation in the required form:

x 3 + y 1 2 = 1 ⇔ 1 3 x + 2 y - 1 = 0

Answer: 1 3 x + 2 y - 1 = 0 .

Drawing up a general equation of a line

We said above that the general equation can be written with known coordinates of the normal vector and the coordinates of the point through which the line passes. Such a straight line is defined by the equation A (x - x 0) + B (y - y 0) = 0. There we also analyzed the corresponding example.

Now let's look at more complex examples, in which first we need to determine the coordinates of the normal vector.

Example 11

Given a line parallel to the line 2 x - 3 y + 3 3 = 0. The point M 0 (4, 1) through which the given line passes is also known. It is necessary to write down the equation of the given line.

Solution

The initial conditions tell us that the lines are parallel, then, as the normal vector of the line, the equation of which needs to be written, we take the direction vector of the line n → = (2, - 3): 2 x - 3 y + 3 3 = 0. Now we know all the necessary data to create the general equation of the line:

A (x - x 0) + B (y - y 0) = 0 ⇔ 2 (x - 4) - 3 (y - 1) = 0 ⇔ 2 x - 3 y - 5 = 0

Answer: 2 x - 3 y - 5 = 0 .

Example 12

The given line passes through the origin perpendicular to the line x - 2 3 = y + 4 5. It is necessary to create a general equation for a given line.

Solution

The normal vector of a given line will be the direction vector of the line x - 2 3 = y + 4 5.

Then n → = (3, 5) . The straight line passes through the origin, i.e. through point O (0, 0). Let's create a general equation for a given line:

A (x - x 0) + B (y - y 0) = 0 ⇔ 3 (x - 0) + 5 (y - 0) = 0 ⇔ 3 x + 5 y = 0

Answer: 3 x + 5 y = 0 .

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

Lesson from the series “Geometric algorithms”

Hello dear reader!

Today we will start learning algorithms related to geometry. The fact is that there are quite a lot of Olympiad problems in computer science related to computational geometry, and solving such problems often causes difficulties.

Over the course of several lessons, we will consider a number of elementary subtasks on which the solution of most problems in computational geometry is based.

In this lesson we will create a program for finding the equation of a line, passing through given two points. To solve geometric problems, we need some knowledge of computational geometry. We will devote part of the lesson to getting to know them.

Insights from Computational Geometry

Computational geometry is a branch of computer science that studies algorithms for solving geometric problems.

The initial data for such problems can be a set of points on a plane, a set of segments, a polygon (specified, for example, by a list of its vertices in clockwise order), etc.

The result can be either an answer to some question (such as does a point belong to a segment, do two segments intersect, ...), or some geometric object (for example, the smallest convex polygon connecting given points, the area of ​​a polygon, etc.) .

We will consider problems of computational geometry only on the plane and only in the Cartesian coordinate system.

Vectors and coordinates

To apply the methods of computational geometry, it is necessary to translate geometric images into the language of numbers. We will assume that the plane is given a Cartesian coordinate system, in which the direction of rotation counterclockwise is called positive.

Now geometric objects receive an analytical expression. So, to specify a point, it is enough to indicate its coordinates: a pair of numbers (x; y). A segment can be specified by specifying the coordinates of its ends; a straight line can be specified by specifying the coordinates of a pair of its points.

But our main tool for solving problems will be vectors. Let me therefore recall some information about them.

Line segment AB, which has a point A is considered the beginning (point of application), and the point IN– end, called a vector AB and is denoted by either or by a bold lowercase letter, for example A .

To denote the length of a vector (that is, the length of the corresponding segment), we will use the modulus symbol (for example, ).

An arbitrary vector will have coordinates equal to the difference between the corresponding coordinates of its end and beginning:

,

here are the points A And B have coordinates respectively.

For calculations we will use the concept oriented angle, that is, an angle that takes into account the relative position of the vectors.

Oriented angle between vectors a And b positive if the rotation is from the vector a to vector b is performed in a positive direction (counterclockwise) and negative in the other case. See Fig.1a, Fig.1b. It is also said that a pair of vectors a And b positively (negatively) oriented.

Thus, the value of the oriented angle depends on the order in which the vectors are listed and can take values ​​in the interval.

Many problems in computational geometry use the concept of vector (skew or pseudoscalar) products of vectors.

The vector product of vectors a and b is the product of the lengths of these vectors and the sine of the angle between them:

.

Cross product of vectors in coordinates:

The expression on the right is a second-order determinant:

Unlike the definition given in analytical geometry, is a scalar.

The sign of the vector product determines the position of the vectors relative to each other:

a And b positively oriented.

If the value is , then a pair of vectors a And b negatively oriented.

The cross product of nonzero vectors is zero if and only if they are collinear ( ). This means that they lie on the same line or on parallel lines.

Let's look at a few simple problems that are necessary when solving more complex ones.

Let's determine the equation of a straight line from the coordinates of two points.

Equation of a line passing through two different points specified by their coordinates.

Let two non-coinciding points be given on a straight line: with coordinates (x1; y1) and with coordinates (x2; y2). Accordingly, a vector with a start at a point and an end at a point has coordinates (x2-x1, y2-y1). If P(x, y) is an arbitrary point on our line, then the coordinates of the vector are equal to (x-x1, y – y1).

Using the vector product, the condition for collinearity of vectors and can be written as follows:

Those. (x-x1)(y2-y1)-(y-y1)(x2-x1)=0

(y2-y1)x + (x1-x2)y + x1(y1-y2) + y1(x2-x1) = 0

We rewrite the last equation as follows:

ax + by + c = 0, (1)

c = x1(y1-y2) + y1(x2-x1)

So, the straight line can be specified by an equation of the form (1).

Problem 1. The coordinates of two points are given. Find its representation in the form ax + by + c = 0.

In this lesson we learned some information about computational geometry. We solved the problem of finding the equation of a line from the coordinates of two points.

In the next lesson, we will create a program to find the intersection point of two lines given by our equations.