Optimize iD.geo.dist, fixes #685

See benchmark: http://jsperf.com/id-dist-optimization