How to find distance between center of rectangle and bound with degree?

121 Views Asked by At

Given width and height of rectangle, coordinates of centroid and degree, how to find coordinates of a point extended from centroid with degree?
In the below image, I want to calculate (??, ??). Any advise will be appreciated. Thanks in advance.

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

We can assume $x_1 = y_1 = 0$, if you need another point then just shift all numbers by $x_1$ and $y_1$.

It's easy to use trigonometry to show that the point where the line intersects the right edge (or its extension) will be $\left(x_3, \frac{y_3}{\cos \theta}\right)$. You can compute the other ones too, for example the top edge will meet at $\left(\frac{x_2}{\sin \theta}, y_2\right)$.

Now just use a simple approach, the Pythagorean theorem, to see which point is the first point that the line intersects.