If we have two vector data such as polygons or polylines (shown in graph below). How can we get find the overlap and create a new x,y vector data for this new shape? (or simply get the area of the new shape.
import numpy as np
import matplotlib.pyplot as plt
x1 = [10, 20, 40, 50, 50, 40, 20, 10, 10];
y1 = [20, 10, 10, 20, 40, 50, 50, 40, 20];
x2 = [30, 60, 30, 0, 30];
y2 = [40, 50, 70, 60, 40];
fig, ax = plt.subplots()
ax.plot(x1, y1)
ax.plot(x2, y2)
plt.show()
For example, for the above graph where the intersections are, can we get the x,y coordinates/data for this new shape created from the overlap? or get the area of it instead?