13 lines
269 B
JavaScript
13 lines
269 B
JavaScript
module.exports = squaredLength
|
|
|
|
/**
|
|
* Calculates the squared length of a vec2
|
|
*
|
|
* @param {vec2} a vector to calculate squared length of
|
|
* @returns {Number} squared length of a
|
|
*/
|
|
function squaredLength(a) {
|
|
var x = a[0],
|
|
y = a[1]
|
|
return x*x + y*y
|
|
} |