UNPKG

@jscad/modeling

Version:

Constructive Solid Geometry (CSG) Library for JSCAD

15 lines (13 loc) 335 B
/** * Calculates the squared length of the given vector. * * @param {vec2} vector - vector of reference * @returns {Number} squared length * @alias module:modeling/maths/vec2.squaredLength */ const squaredLength = (vector) => { const x = vector[0] const y = vector[1] return x * x + y * y } module.exports = squaredLength