Set distance threshold