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

Function getDirection

docs/tests/v2/es6/js/sanddance.js:52064–52074  ·  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

52062
52063
52064 function getDirection(x, y) {
52065 if (x === y) {
52066 return DIRECTION_NONE;
52067 }
52068
52069 if (abs(x) >= abs(y)) {
52070 return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
52071 }
52072
52073 return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
52074 }
52075 /**
52076 * calculate the absolute distance between two points
52077 * @param {Object} p1 {x, y}

Callers 2

computeInputDataFunction · 0.70
computeIntervalInputDataFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected