@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.
10 lines (9 loc) • 473 B
TypeScript
import type { ArrayVector3D } from "./types.js";
/**
* Sets the magnitude (length) of a 3D vector, maintaining its direction.
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
* @param {number} newMagnitude - New magnitude
* @param {number} [m] - Optional current magnitude (default: `magnitude3D(xyz)`)
* @returns {ArrayVector3D} The adjusted vector
*/
export declare const setMagnitude3D: (xyz: ArrayVector3D, newMagnitude: number, m?: number) => ArrayVector3D;