@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.
11 lines (10 loc) • 396 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.magnitude4D = void 0;
/**
* Calculates the magnitude (length) of a 4D vector.
* @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
* @returns {number} The magnitude
*/
const magnitude4D = (xyzw) => Math.sqrt(xyzw[0] ** 2 + xyzw[1] ** 2 + xyzw[2] ** 2 + xyzw[3] ** 2);
exports.magnitude4D = magnitude4D;