caculate distance with sphere-based formula for better performance.
close #7