Two Quadrilaterals Intersection Area (Special Case)

Okay, I have probably figured it out. The algorithm goes as follows:

  1. For each vertex of the first quadrilateral, check whether it is contained inside the second one - if so, store coordinates of the point.
  2. For each vertex of the second quadrilateral, check whether it is contained inside the first one - if so, store coordinates of the point.
  3. For each edge of one of the quadrilaterals (does not matter which one), check for intersections with edges of the other. Store coordinates of intersection points.
  4. Compute triangulation for all the points stored so far.
  5. Sum up areas of the triangles.