def getErrorPair(model, pair):
    """
    get error for the given pair of points and the model.
    ie calculate error = (p' - pcalc)**2,
    with pcalc = model * p
    """
    tx = model[0]
    ty = model[1]
    p = pair[0]
    pprime = pair[1]
    x = p[0]
    y = p[1]
    xprime = pprime[0]
    yprime = pprime[1]
    xcalc = x + tx
    ycalc = y + ty
    xdiff = xcalc-xprime
    ydiff = ycalc-yprime
    err = xdiff**2 + ydiff**2
    return err