# Intersection between a side of rotated rectangle and axis

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:

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).$$

• @Arentino, thanx!!! Can you explain this formula? – Ilya Sep 28 '15 at 7:53
• 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$. – Aretino Sep 28 '15 at 17:52