UNPKG

@fimbul-works/vec

Version:

A comprehensive TypeScript vector math library providing 2D, 3D, and 4D vector operations with a focus on performance and type safety.

12 lines (11 loc) 442 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.magnitudeSq4D = void 0; /** * Calculates the squared magnitude of a 4D vector. * Faster than magnitude for comparisons. * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]` * @returns {number} The squared magnitude */ const magnitudeSq4D = (xyzw) => xyzw[0] ** 2 + xyzw[1] ** 2 + xyzw[2] ** 2 + xyzw[3] ** 2; exports.magnitudeSq4D = magnitudeSq4D;