MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / distanceTo

Method distanceTo

src/common/commontypes/Pixel.js:101–103  ·  view source on GitHub ↗

* @function Pixel.prototype.distanceTo * @description 返回两个 pixel 的距离。 * @example * var pixcel = new Pixel(100,50); * var pixcel2 = new Pixel(110,30); * var distance = pixcel.distanceTo(pixcel2); * * @param {Pixel} px - 需要计算的 pixel。 * @returns {number} 作为参数传入的像素与当前像素点的距离。

(px)

Source from the content-addressed store, hash-verified

99 * @returns {number} 作为参数传入的像素与当前像素点的距离。
100 */
101 distanceTo(px) {
102 return Math.sqrt(Math.pow(this.x - px.x, 2) + Math.pow(this.y - px.y, 2));
103 }
104
105 /**
106 * @function Pixel.prototype.add

Callers 10

PixelSpec.jsFile · 0.80
UnicodeMarker.jsFile · 0.80
mapbox-gl.jsFile · 0.80
jrFunction · 0.80
leaflet.jsFile · 0.80
$eFunction · 0.80
hiFunction · 0.80
leaflet-src.jsFile · 0.80
polygonCenterFunction · 0.80
polylineCenterFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected