Write calculate distance for single points