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

Function getDirection

docs/app/js/sanddance-app.js:93013–93017  ·  view source on GitHub ↗

* get the direction between two points * @param {Number} x * @param {Number} y * @return {Number} direction

(x, y)

Source from the content-addressed store, hash-verified

93011 * @param {Number} y
93012 * @return {Number} direction
93013 */ function getDirection(x, y) {
93014 if (x === y) return DIRECTION_NONE;
93015 if (abs(x) >= abs(y)) return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
93016 return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
93017 }
93018 /**
93019 * calculate the absolute distance between two points
93020 * @param {Object} p1 {x, y}

Callers 2

computeInputDataFunction · 0.70
computeIntervalInputDataFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected