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

Method distance

src/common/overlay/levelRenderer/Vector.js:215–220  ·  view source on GitHub ↗

* @function LevelRenderer.Tool.Vector.prototype.distance * @description 计算向量间距离。 * * @param {Vector2} v1 - 向量 v1。 * @param {Vector2} v2 - 向量 v2。 * @return {number} 向量间距离。

(v1, v2)

Source from the content-addressed store, hash-verified

213 * @return {number} 向量间距离。
214 */
215 distance(v1, v2) {
216 return Math.sqrt(
217 (v1[0] - v2[0]) * (v1[0] - v2[0])
218 + (v1[1] - v2[1]) * (v1[1] - v2[1])
219 );
220 }
221
222 /**
223 * @function LevelRenderer.Tool.Vector.prototype.distanceSquare

Callers 9

distMethod · 0.95
NonEarthCRSSpec.jsFile · 0.80
interpolateFunction · 0.80
VectorSpec.jsFile · 0.80
SUtil_smoothBezierMethod · 0.80
SUtil_smoothSplineMethod · 0.80
leaflet.jsFile · 0.80
leaflet-src.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected