Calculate distance between source and target points