@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) • 413 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.angleZ4D = void 0;
/**
* Calculates the angle between a 4D vector and the positive z-axis.
* @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
* @returns {number} The angle in radians
*/
const angleZ4D = (xyzw) => Math.atan2(Math.sqrt(xyzw[3] ** 2 + xyzw[0] ** 2 + xyzw[1] ** 2), xyzw[2]);
exports.angleZ4D = angleZ4D;