Answer the question
In order to leave comments, you need to log in
How to calculate the position of a point on the border of a rotated rectangle if the position on the border of the original rectangle is known?
I know this is a problem for the seventh grade, but I can’t solve something correctly.
I have a point outside of a rectangle. The point is projected onto the border of the rectangle at a right angle. The rectangle can be rotated around its center to any angle (also the point can move around the rectangle).
For example, I took 3 variants of the rectangle α = 0 ° (red), α = 45 ° (blue) and α = 18 ° (green). There is also the height h, width w of the rectangle, and X, Y (the center of the rectangle).
I can calculate X 1 Y 1 with simple math. But calculate X 2 Y 2 or X 3 Y 3is a more difficult task. So how can I calculate X 2 Y 2 and X 3 Y 3 ?
Answer the question
In order to leave comments, you need to log in
It is possible to solve an equivalent problem when not a rectangle is rotated, but a point (around the center of the rectangle by the same angle, but in the opposite direction). Then recalculate the coordinates, shifting the origin to the center of the rectangle and using the rotation matrix https://ru.wikipedia.org/wiki/Rotation_Matrix
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question