* get the direction between two points * @param {Number} x * @param {Number} y * @return {Number} direction
(x, y)
| 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} |
no outgoing calls
no test coverage detected