There is a rectangle with center in 0,0 position of decart coordinate system. I know the rectangle width, height and an angle of rotate. How can I find coordinates of intersection point (and length) between x/y axis and rectangle sides?

We need to find A1 and B1: Please, look at this picture


If the rotation angle $\alpha$ is between $0°$ and $90°$ then: $$ A1=\min\left({A\over\cos\alpha},\ {B\over\sin\alpha}\right),\quad B1=\min\left({B\over\cos\alpha},\ {A\over\sin\alpha}\right). $$

  • $\begingroup$ @Arentino, thanx!!! Can you explain this formula? $\endgroup$ – Ilya Sep 28 '15 at 7:53
  • 1
    $\begingroup$ If $\alpha<90°$ then $A1$ is formed by the intersection between the $x$-axis and the bottom or left side of rectangle. The bottom side (produced if needed) intersects the $x$-axis at $x=B/\sin\alpha$, while the intersection with the left side is at $x=A/\cos\alpha$. You just need to pick the smallest value to have the right result. A similar reasoning can be made for $B1$. $\endgroup$ – Aretino Sep 28 '15 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.