Calculate distance between two points (#374)