Say the coordinates of the vertices of two polygons, A and B, have been given. Let's say A is an n-sided polygon with the coordinates of its vertices ($x_{a1}, y_{a1})$ through ($x_{an}, y_{an})$, and B is an m-sided polygon with the coordinates of its vertices ($x_{b1}, y_{b1})$ through ($x_{bm}, y_{bm})$. How do I calculate the percentage area of overlap between the two.
I know that broadly its going to be the following:
$Percentage$ $overlap = \frac{Area \, of \, intersection \, of \, A \, and \, B}{Area \, of \, A \, + \, Area \, of \, B \, - \, Area \, of \, intersection \, of \, A \, and \, B}$
But, how to determine the area of intersection of the two polygons?
P.S.: If it turns out that there's no generalized answer for any type of convex polygon, let's take the polygons to be equi-angular, but they can still have any orientation, like the example shown below where the square is "tilted", and they can each have their sides of unequal length (like, rectangle instead of square, etc).
Or if even that is not possible, let's take the two polygons to have the same number of sides (i.e., they're both rectangles, or both hexagons, etc) - but they can still be rotated, or tilted, at different angles.
