Files
railwaysystem/RuoYi-Vue/ruoyi-ui/node_modules2/gl-vec2/distance.js
T
2026-09-10 15:40:10 +08:00

14 lines
323 B
JavaScript

module.exports = distance
/**
* Calculates the euclidian distance between two vec2's
*
* @param {vec2} a the first operand
* @param {vec2} b the second operand
* @returns {Number} distance between a and b
*/
function distance(a, b) {
var x = b[0] - a[0],
y = b[1] - a[1]
return Math.sqrt(x*x + y*y)
}