Implemented thresholdDistance()