Square root doesn't need to be calculated if we introduce function that calculates squares of distances instead of distances. Result of the calculation can be compared with delta * delta.