标签:
distanceTo: function(point) { var distance = 0.0; if ((this.x != null) && (this.y != null) && (point != null) && (point.x != null) && (point.y != null)) { var dx2 = Math.pow(this.x - point.x, 2); var dy2 = Math.pow(this.y - point.y, 2); distance = Math.sqrt(dx2 + dy2); } return distance; }
返回的单位为 km
标签:
原文地址:http://www.cnblogs.com/liuswi/p/4534479.html