@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) • 331 B
JavaScript
/**
* Creates an ArrayVector2D from y-axis angle.
* @param {number} phi - Angle in radians
* @param {number} magnitude - Optional magnitude of the vector (default: `1`)
* @returns {ArrayVector2D} Vector
*/
export const fromAngleY2D = (phi, magnitude = 1) => [
magnitude * -Math.sin(phi),
magnitude * Math.cos(phi),
];