code: def calc_2d_forces(self,x1,y1,x2,y2,width):
          
          #calculate a
          if x1>x2:
              a = x1-x2
          else:
              a = x2-x1
  
          a_sq=a*a
          #calculate b
          if y1>y2:
              b = y1-y2
          else:
              b = y2-y1
  
          b_sq=b*b
  
          #calculate c
          from math import sqrt
          c_sq = a_sq+b_sq
  
          c = sqrt(c_sq)
  
          if c > width:
              return 0,0
          else:
              overlap = width-c
          return -overlap/2, overlap/2
docs: Calculate overlap in 2D space