I can not create an algorithm for finding the coordinates of the vertices of a rectangle with such known variables as the length of the edges , the coordinates of one vertex in the Cartesian coordinate system, the angle of rotation of the local coordinate system of the rectangle.

For example:

  • a and b are the lengths of the edges of the rectangle;
  • A0 (x, y) is the coordinate of the vertex of the rectangle, and it is represented by the center of the local coordinate system of the rectangle;
  • angle - the angle of rotation of the local coordinate system of the rectangle.

I can’t find the coordinates A1, A2, A3 .

  • Specify - rotation of the coordinate system? Or a rectangle rotated by an angle in this coordinate system? - Harry
  • one
    Are you sure this question is related to programming and system administration? - Kromster
  • one
    Harry, thanks for the comment and I apologize for your shortcoming in the description of the question. The angle of rotation of the local coordinate system of the rectangle. - K. Volkov

1 answer 1

So, as I understood the task. There is the usual Cartesian coordinate system, a rectangle, the sides a and b, one of its points, and it is rotated with respect to this point by an angle.

The question is how it was located earlier, what is the lengths a and b.

A3 -------a------<- A2 | | b | | | -------------- ^ ^ A0 A1 

If you imagine the picture in this way, then everything is extremely simple. A0 naturally remains in place.

enter image description here

enter image description here

enter image description here

If this is what you need. But in the general case, the rectangle could already have been initially oriented as desired. You need to clearly set the task - even for yourself, otherwise it turns out "I have to count something!" - "Well, take some formulas ..."

  • The last paragraph is not entirely clear. IMHO problem / task TS is formulated quite clearly - there are edge lengths, angle and coordinates of 1 point. - Kromster
  • @Kromster So what? Imagine that a is vertically, b is horizontally. The formulas are different. And in general - a rectangle by definition - it's just all the angles are straight, and not the sides are vertical and horizontal! The top can be any of the four! A rectangle is not defined uniquely by 4 numbers; - Harry
  • I would still replace the word in the last paragraph "turned" on "oriented horizontally or vertically in the positive or negative direction of the axes" so that there is no overlap with the rotation. - Kromster
  • @Kromster Logical, thanks. - Harry