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.

7 lines (6 loc) 287 B
/** * Calculates the angle between a 4D vector and the positive y-axis. * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]` * @returns {number} The angle in radians */ export const angleY4D = (xyzw) => Math.atan2(Math.sqrt(xyzw[2] ** 2 + xyzw[3] ** 2 + xyzw[0] ** 2), xyzw[1]);