@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) • 412 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.angleX2D = void 0;
/**
* Gets the angle between a 2D vector and the positive x-axis in radians.
* @param {ArrayVector2D} xy - Vector as `[x, y]`
* @returns {number} Angle in radians, always in the range [0, 2π)
*/
const angleX2D = (xy) => Math.atan2(xy[1], xy[0] + (xy[1] < 0 ? Math.PI : 0));
exports.angleX2D = angleX2D;