import type { ReadonlyMatrix } from "./matrix.js"; /** * A 3D vector. */ export type Vector = [x: number, y: number, z: number]; /** * Creates a new vector by applying a function component-wise to the components * of one or more input vectors. * * @example Find the sum of two vectors * ```typescript * apply((a, b) => a + b, [1, 2, 3], [4, 5, 6]); // [5, 7, 9] * ``` * * @example Scale a vector by a scalar * ```typescript * apply((i) => i * 2, [1, 2, 3]); // [2, 4, 6] * ``` * * @example Interpolate between two vectors * ```typescript * apply((a, b) => a + (b - a) / 2, [1, 2, 3], [4, 5, 6]); // [2.5, 3.5, 4.5] * ``` * * @param fn - The function to apply to each component. * @param v - The vectors. * * @returns The resulting vector. */ export declare function apply(fn: (...n: N) => number, ...v: { [Property in keyof N]: Vector; }): Vector; /** * Finds the cross product of two vectors. * * @param a - The first vector. * @param b - The second vector. * * @returns The resulting vector. */ export declare function cross([a1, a2, a3]: Vector, [b1, b2, b3]: Vector): Vector; /** * Finds the dot product of two vectors. * * @param a - The first vector. * @param b - The second vector. * * @returns The resulting scalar. */ export declare function dot([a1, a2, a3]: Vector, [b1, b2, b3]: Vector): number; /** * Finds the Euclidean norm of a vector. * * @param v - The vector. * * @returns The Euclidean norm. */ export declare function norm(v: Vector): number; /** * Finds a vector in the same direction as v but with norm 1. * * @see https://github.com/FFI-no/n-vector/blob/f77f43d18ddb6b8ea4e1a8bb23a53700af965abb/nvector/unit.m * * @param v - A vector. * * @returns A normalized vector. */ export declare function normalize([x, y, z]: Vector): Vector; /** * Transforms a vector by a matrix. * * @param r - A transformation matrix. * @param v - A vector. * * @returns The transformed vector. */ export declare function transform([[r11, r12, r13], [r21, r22, r23], [r31, r32, r33]]: ReadonlyMatrix, [x, y, z]: Vector): Vector;