computation of inner border