def intersectarea(p1,p2,size):
 """
 Given 2 boxes, this function returns intersection area
 """
 x1, y1 = p1
 x2, y2 = p2
 ix1, iy1 = max(x1,x2), max(y1,y2)
 ix2, iy2 = min(x1+size,x2+size), min(y1+size,y2+size)
 iarea = abs(ix2-ix1)*abs(iy2-iy1)
 if iy2 < iy1 or ix2 < ix1: iarea = 0
 return iarea

 Given 2 boxes, this function returns intersection area
 
recipes/Python/576689_Copymove_forgery/recipe-576689.py