Fast code for regular spatial clustering on euclidean distances