@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.
17 lines (16 loc) • 567 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromSphericalCoords3D = void 0;
/**
* Creates a 3D vector from spherical coordinates.
* @param {number} theta - First angle
* @param {number} phi - Second angle
* @param {number} [m] - Optional magnitude (default: `1`)
* @returns {ArrayVector3D} Vector
*/
const fromSphericalCoords3D = (theta, phi, m = 1) => [
m * Math.sin(theta) * Math.cos(phi),
m * Math.sin(theta) * Math.sin(phi),
m * Math.cos(theta),
];
exports.fromSphericalCoords3D = fromSphericalCoords3D;