add setDistance to two edges