The task is to write a program that determines the position of two points on the plane, in other words, their coordinates.

There is a system of three segments (the so-called cat's leg), the ends of the first and third of which coincide with the ends of the second. Schematically (without taking into account the angles) you can present it like this: (A) ------ (B) ------ (C) ------ (D) (segments, respectively, AB, BC and CD). The input of the program receives the length of these segments and the coordinates of points A and D. It is known that the angle ABC (that is, formed by the segments AB and BC) corresponds to the angle BCD as c (this parameter is also fed into the program). Find points B and C.

Please help to make this program.

Adding.

The system of equations is as follows:

( x(A) - x(B) ) ^ 2 + ( y(A) - y(B) ) ^ 2 = |AB| ^ 2 ; ( x(D) - x(C) ) ^ 2 + ( y(D) - y(C) ) ^ 2 = |CD| ^ 2 ; ( x(B) - x(C) ) ^ 2 + ( y(B) - y(C) ) ^ 2 = |BC| ^ 2 ; β = c * γ . 

Here x (T) is the x coordinate of T; y (T) - y, respectively; | OT | - the distance between points O and T (the length of the segment OT); β is the angle ABC, γ is BCD, c is the given constant.

  • a) the mathematical formulas for solving the problem are proposed to be derived by yourself? b) are there any restrictions on the input data? AB and CD lie in one half-plane from BC? Or is it not important? > It is necessary to find points B and C. This means - "it is necessary to find the coordinates of points B and C". - gecube
  • "Mathematical formulas for solving the problem are proposed to be derived by yourself?" - Of course, because otherwise what would be the meaning of the problem? "Are there any restrictions on the input data? AB and CD lie in one half-plane from BC? Or is it not important?" - just like that, it doesn't matter; accordingly, the angles can range from 0 to 2 * pi (in the diagram attached to the problem, AB and CD lay in different half-planes from BC). "Ie, we know the angle ratio ABC / BCD = x, x is transferred to the program?" - exactly. The authors called it the letter "c". "it is necessary to find the coordinates of points B and C" - yes, you understood everything correctly. - Russian
  • > of course, because otherwise what would be the meaning of the problem? Encode an algorithm that calculates the required values ​​using the formula :-) I remember how the school also wrote programs for calculating the roots of a quadratic equation. - gecube
  • Well, that would be too easy. And so there is something to think about. For example, I tried to represent points A and D as constants, and B and C as variables, which described circles around the whole range of their values ​​(B around A, and C around D), from which I made two equations, plus one for the ratio B and C (also the equation of a circle) and one more for angles. With him, this system was, in my opinion, generally unsolvable. - Russian
  • Honestly, a little too lazy to write a solution to this problem, more than once during my studies I had to solve them ... but the easiest way to solve it is to use vectors, but I think there’s nothing else to do. - Gautama Buddha

1 answer 1

  1. AD> AB + BC + CD. The system has no solutions. Similarly, if any segment is greater than the sum of the other three
  2. AD = AB + BC + CD. The system has 1 solution. Points B and C lie on the segment AD. Similarly, if one of the segments is equal to the sum of the other three. Plus, it is clear that talking about angles in this case is meaningless. 0/0 = ???
  3. The remaining case :-) We have a broken line. At least two solutions. It is very easy to imagine - we will locate point A at the origin of coordinates, and direct the axis Ox along AD. And here already without corners to not manage.

In any case, I will explain that the correctness of the input data in the program will still have to be checked.

What else can you think of? Take an arbitrary math package (Maple, Mathcad, Mathematica, etc.), formalize the problem as a set of equations and feed the program. According to the resulting formulas to write a program. Or come up with some kind of evaluation function, which in the vicinity of the solution of the problem will have an extremum. And in the program, read its value in the loop for different values ​​of the arguments and look for this very extremum.

  • 1. Yes, this is obvious if you visualize this broken line and gradually straighten it. 2. In this case, the polyline is drawn into a segment, B and C lie on a straight line passing through AD. Just a special case of the 3rd option. 3. That's right. There are two solutions, that is, there will be two points B (well, and C, respectively), but they will be symmetrical with respect to AD. By condition, it suffices to find one of the solutions. As for correctness, it is not supposed that the program will receive incorrect data, however, this is not particularly important. Thanks for the proposed option. Although there is hope that there is a simpler solution. - Russian