code: def resize(line, factor):
      
      a = angle(line)
      mx, my = middle(line)
      d = length(line) * factor * 0.5
      dx = cos(a) * d
      dy = sin(a) * d
      return mx - dx, my - dy, mx + dx, my + dy
docs: factor: relative length (1->no change, 2-> double, 0.5:half)