/** * A vector with 2 components, labeled: `X`, `Y`. */ export declare class Vector2 { /** * The X component of the vector. */ x: number; /** * The Y component of the vector. */ y: number; /** * Constructs a new {@linkcode Vector2}. * @param x - The X component. * @param y - The Y component. */ constructor(x: number, y: number); /** * Creates a copy of another {@linkcode Vector2}. * @param vector - The vector to copy. * @returns A new vector. */ static fromVector2(vector: Readonly): Vector2; /** * Sets the vector to new coordinates. * @param vector - The coordinates to set the vector to. * @returns This instance. */ set(vector: Readonly): this; /** * Sets the vector to new coordinates. * @param x - The new X component for the vector. * @param y - The new Y component for the vector. * @returns This instance. */ setXY(x: number, y: number): this; /** * Adds another vector to this vector. * @param vector - The vector to add to this vector. * @returns This instance. */ add(vector: Readonly): this; /** * Adds another vector to this vector. * @param x - The value to add to the X component. * @param y - The value to add to the Y component. * @returns This instance. */ addXY(x: number, y: number): this; /** * Scales another vector and adds it to this vector. * @param vector - The vector to add to this vector. * @param scale - The scaling to apply to the input vector. * @returns This instance. */ addMultiply(vector: Readonly, scale: number): this; /** * Scales another vector and adds it to this vector. * @param x - The value to add to the X component. * @param y - The value to add to the Y component. * @param scale - The scaling to apply to the input vector. * @returns This instance. */ addMultiplyXY(x: number, y: number, scale: number): this; /** * Subtracts another vector from this vector. * @param vector - The vector to subtract from this vector. * @returns This instance. */ subtract(vector: Readonly): this; /** * Subtracts another vector from this vector. * @param x - The value to subtract from the X component. * @param y - The value to subtract from the Y component. * @returns This instance. */ subtractXY(x: number, y: number): this; /** * Multiplies this vector by another vector. * @param vector - The vector to multiply with this vector. * @returns This instance. */ multiply(vector: Readonly): this; /** * Multiplies this vector by another vector. * @param x - The value to multiply with the X component. * @param y - The value to multiply with the Y component. * @returns This instance. */ multiplyXY(x: number, y: number): this; /** * Multiplies the vector by the given scale. * @param scale - The scaling to apply to the vector. * @returns This instance. */ multiplyScale(scale: number): this; /** * Divides this vector by another vector. * @param vector - The vector to divide this vector with. * @returns This instance. */ divide(vector: Readonly): this; /** * Divides this vector by another vector. * @param x - The value to divide the X component with. * @param y - The value to divide the Y component with. * @returns This instance. */ divideXY(x: number, y: number): this; /** * Divides the vector by the given scale. * @param scale - The scaling to apply to the vector. * @returns This instance. */ divideScale(scale: number): this; /** * Inverts the direction of the vector. * @returns This instance. */ invertAdd(): this; /** * Inverts the vectors scale. * @returns This instance. */ invertMultiply(): this; /** * Clamps the components of the vector at the given boundary. * @param floor - The lowest value to allow. * @param ceil - The largest value to allow. * @returns This instance. */ clamp(floor: number, ceil: number): this; /** * Calculates the length of the vector. * @returns The length of the vector. */ length(): number; /** * Normalizes the vector. * @returns This instance. */ normalize(): this; /** * Compares two vectors. * @param vector - The vector to compare this vector to. * @returns `true` if the vectors are idently, `false` otherwise. */ compare(vector: Readonly): boolean; /** * Linearly moves this vector towards a target vector. * @param vector - The target vector. * @param t - The location on the scale, from `0` to `1`. * @returns This instance. */ lerp(vector: Readonly, t: number): this; /** * Rotates the vector by the given angle. * @param angle - The angle in degrees. * @returns This instance. */ rotate(angle: number): this; /** * Returns the dot product between two vectors. * @param vector - The other vector. * @returns The dot product between the two vectors. */ dot(vector: Readonly): number; /** * Returns the dot product between two vectors. * @param x - The X component of the other vector. * @param y - The Y component of the other vector. * @returns The dot product between the two vectors. */ dotXY(x: number, y: number): number; /** * Return the components of this vector as an array. * @returns The components of this vector as an array. */ asArray(): [number, number]; } /** * Adds two vectors and returns a new vector with the result. * @param a - The first input vector. * @param b - The second input vector. * @returns A new {@linkcode Vector2}. */ export declare const addVector2: (a: Readonly, b: Readonly) => Vector2; /** * Multiplies two vectors and returns a new vector with the result. * @param a - The first input vector. * @param b - The second input vector. * @returns A new {@linkcode Vector2}. */ export declare const multiplyVector2: (a: Readonly, b: Readonly) => Vector2; /** * Subtracts two vectors and returns a new vector with the result. * @param a - The first input vector. * @param b - The second input vector. * @returns A new {@linkcode Vector2}. */ export declare const subtractVector2: (a: Readonly, b: Readonly) => Vector2;