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

相关文章:

  • 2022-12-23
  • 2021-12-21
  • 2021-04-25
  • 2022-02-16
  • 2021-12-01
  • 2022-01-25
  • 2021-12-24
  • 2021-12-09
猜你喜欢
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-01-23
  • 2022-12-23
相关资源
相似解决方案