* 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)
| 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 |
no outgoing calls
no test coverage detected