MCPcopy Create free account
hub / github.com/microsoft/SandDance / getDistance

Function getDistance

docs/tests/v2/es6/js/sanddance.js:52084–52092  ·  view source on GitHub ↗

* calculate the absolute distance between two points * @param {Object} p1 {x, y} * @param {Object} p2 {x, y} * @param {Array} [props] containing x and y keys * @return {Number} distance

(p1, p2, props)

Source from the content-addressed store, hash-verified

52082
52083
52084 function getDistance(p1, p2, props) {
52085 if (!props) {
52086 props = PROPS_XY;
52087 }
52088
52089 var x = p2[props[0]] - p1[props[0]],
52090 y = p2[props[1]] - p1[props[1]];
52091 return Math.sqrt(x * x + y * y);
52092 }
52093 /**
52094 * calculate the angle between two coordinates
52095 * @param {Object} p1

Callers 3

computeInputDataFunction · 0.70
getScaleFunction · 0.70
sanddance.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected