store squared distances for speed-up