Changes resampling to be based on cumulative dist variance, fixes line intersection