# Common area of two rectangles

Suppose we have a rectangle at the center of the coordinates. One top point of the rectangle has the coordinates (a, b), the second (-a, b), third (-a, -b) and (a, -b). We rotate this rectangle with the angle $\phi$ counterclockwise to get a second rectangle.

Question: Find the common area of these two rectangles.

By common area I mean the area of the polygon that is limited by the intersection points of the two rectangles

-

I'll assume $0<a<b$ and $0\leq\phi\leq\frac\pi2$. All other cases can be reduced to this.

Case 1: $\phi < 2\arctan\left(\frac ab\right)$

In this case you have an octagonal intersection, with an area of

$$2\frac{2ab\sin(\phi) + \bigl(a^2 + b^2\bigr)\bigl(\cos(\phi) - 1\bigr)} {\sin(\phi)\,\cos(\phi)}$$

Case 2: $\phi \geq 2\arctan\left(\frac ab\right)$

In this case you get a quadrilateral intersection, with an area of

$$\frac{4a^2}{\sin(\phi)}$$

I obtained the above results using symbolic expressions for all coordinates, performing the computation using sage.

-