import type { Vector2, Vector3 } from '../types'; /** * 两个向量求和 * * Adds two vectors * @param a - 第一个向量 | The first vector * @param b - 第二个向量 | The second vector * @returns 两个向量的和 | The sum of the two vectors */ export declare function add(a: Vector2 | Vector3, b: Vector2 | Vector3): Vector2 | Vector3; /** * 两个向量求差 * * Subtracts two vectors * @param a - 第一个向量 | The first vector * @param b - 第二个向量 | The second vector * @returns 两个向量的差 | The difference of the two vectors */ export declare function subtract(a: Vector2 | Vector3, b: Vector2 | Vector3): Vector2 | Vector3; /** * 两个向量求积或者向量和标量求积 * * Multiplies two vectors or a vector and a scalar * @param a - 向量 | The vector * @param b - 向量或者标量 | The vector or scalar * @returns 两个向量的积或者向量和标量的积 | The product of the two vectors or the product of the vector and scalar */ export declare function multiply(a: Vector2 | Vector3, b: number | Vector2 | Vector3): Vector2 | Vector3; /** * 两个向量求商或者向量和标量求商 * * Divides two vectors or a vector and a scalar * @param a - 向量 | The vector * @param b - 向量或者标量 | The vector or scalar * @returns 两个向量的商或者向量和标量的商 | The quotient of the two vectors or the quotient of the vector and scalar */ export declare function divide(a: Vector2 | Vector3, b: number | Vector2 | Vector3): Vector2 | Vector3; /** * 两个向量求点积 * * Calculates the dot product of two vectors * @param a - 第一个向量 | The first vector * @param b - 第二个向量 | The second vector * @returns 两个向量的点积 | The dot product of the two vectors */ export declare function dot(a: Vector2 | Vector3, b: Vector2 | Vector3): number; /** * 两个二维向量求叉积 * * Calculates the cross product of two vectors in three-dimensional Euclidean space * @param a - 第一个向量 | The first vector * @param b - 第二个向量 | The second vector * @returns 两个向量的叉积 | The cross product of the two vectors */ export declare function cross(a: Vector2 | Vector3, b: Vector2 | Vector3): Vector3; /** * 向量缩放 * * Scales a vector by a scalar number * @param a - 向量 | The vector to scale * @param s - 缩放系数 | Scale factor * @returns 缩放后的向量 | The scaled vector */ export declare function scale(a: Vector2 | Vector3, s: number): Vector2 | Vector3; /** * 计算两个向量间的欧几里得距离 * * Calculates the Euclidean distance between two vectors * @param a - 第一个向量 | The first vector * @param b - 第二个向量 | The second vector * @returns 两个向量间的距离 | The distance between the two vectors */ export declare function distance(a: Vector2 | Vector3, b: Vector2 | Vector3): number; /** * 计算两个向量间的曼哈顿距离 * * Calculates the Manhattan distance between two vectors * @param a - 第一个向量 | The first vector * @param b - 第二个向量 | The second vector * @returns 两个向量间的距离 | The distance between the two vectors */ export declare function manhattanDistance(a: Vector2 | Vector3, b: Vector2 | Vector3): number; /** * 标准化向量(使长度为 1) * * Normalizes a vector (making its length 1) * @param a - 要标准化的向量 | The vector to normalize * @returns 标准化后的向量 | The normalized vector */ export declare function normalize(a: Vector2 | Vector3): Vector2 | Vector3; /** * 计算两个向量间的夹角,输出为锐角余弦值 * * Get the angle between two vectors * @param a - 第一个向量 | The first vector * @param b - 第二个向量 | The second vector * @param clockwise - 是否顺时针 | Whether to calculate the angle in a clockwise direction * @returns 弧度值 | The angle in radians */ export declare function angle(a: Vector2 | Vector3, b: Vector2 | Vector3, clockwise?: boolean): number; /** * 判断两个向量是否完全相等(使用 === 比较) * * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===) * @param a - 第一个向量 | The first vector * @param b - 第二个向量 | The second vector * @returns - 是否相等 | Whether or not the vectors are equal */ export declare function exactEquals(a: Vector2 | Vector3, b: Vector2 | Vector3): boolean; /** * 计算向量的垂直向量 * * Calculates the perpendicular vector to a given vector * @param a - 原始向量 | The original vector * @param clockwise - 是否顺时针 | Whether to calculate the perpendicular vector in a clockwise direction * @returns 原始向量的垂直向量 | The perpendicular vector to the original vector */ export declare function perpendicular(a: Vector2, clockwise?: boolean): Vector2; /** * 计算向量的模 * * Calculates the modulus of a vector * @param a - 原始向量 | The original vector * @param b - 模 | The modulus * @returns - 向量的模 | The modulus of the vector */ export declare function mod(a: Vector2 | Vector3, b: number): Vector2 | Vector3; /** * 向量强制转换为二维向量 * * Force vector to be two-dimensional * @param a - 原始向量 | The original vector * @returns 二维向量 | Two-dimensional vector */ export declare function toVector2(a: Vector2 | Vector3): Vector2; /** * 向量强制转换为三维向量 * * Force vector to be three-dimensional * @param a - 原始向量 | The original vector * @returns - 三维向量 | Three-dimensional vector */ export declare function toVector3(a: Vector2 | Vector3): Vector3; /** * 计算向量与 x 轴正方向的夹角(弧度制) * * The angle between the vector and the positive direction of the x-axis (radians) * @param a - 向量 | The vector * @returns 弧度值 | The angle in radians */ export declare function rad(a: Vector2 | Vector3): number;