import * as PIXI from 'pixi.js'; import { ObservableVector2 } from './ObservableVector2'; export declare type XY = [x: number, y: number]; export declare class Vector2 implements PIXI.IPoint { protected _values: Float32Array; constructor(); constructor(points: PIXI.IPointData); constructor(x: number, y: number); constructor(xy: XY); /** * Retrieves a new instance of the vector (0, 0) * @returns - The zero vector */ static get zero(): Vector2; /** * @returns - The x-component of the vector */ get x(): number; /** * @param value - The new x-component of the vector */ set x(value: number); /** * @returns - The y-component of the vector */ get y(): number; /** * @param value - The new y-component of the vector */ set y(value: number); /** * @returns - An array containing the x-component and y-component of the vector */ get xy(): XY; /** * @param values - An array containing the new x-component and y-component of the vector */ set xy(values: XY); /** * Retrieves the maximum vector values between two or more vectors. * @param vector * @param vectors * @returns - The result of the maximum vector values. */ static max(vector: Vector2, ...vectors: Vector2[]): Vector2; /** * Retrieves the minimum vector values between two or more vectors. * @param vector * @param vectors * @returns - The result of the minimum vector values. */ static min(vector: Vector2, ...vectors: Vector2[]): Vector2; /** * Calculates the dot product of two vectors. * @param vector * @param vector2 * @returns - The dot product of the two vectors. */ static dot(vector: Vector2, vector2: Vector2): number; /** * Calculates the distance between two vectors. * @param vector * @param vector2 * @returns - The distance between the two vectors. */ static distance(vector: Vector2, vector2: PIXI.IPointData): number; /** * Calculates the distance between two vectors squared. * @param vector * @param vector2 * @returns - The distance between the two vectors. */ static squaredDistance(vector: Vector2, vector2: PIXI.IPointData): number; /** * Calculates a normalized vector representing the direction from one vector to another. * If no dest vector is specified, a new vector is instantiated. * @param vector * @param vector2 * @param dest - An optional destination Vector2. * @returns */ static direction(vector: Vector2, vector2: Vector2, dest?: Vector2): Vector2; /** * Performs a linear interpolation over two vectors. * If no dest vector is specified, a new vector is instantiated. * @param a * @param b * @param t * @param dest - An optional destination Vector2. * @returns */ static lerp(a: Vector2, b: Vector2, t: number, dest?: Vector2): Vector2; /** * Adds two vectors. * If no dest vector is specified, a new vector is instantiated. * @param vector * @param vector2 * @param dest - An optional destination Vector2. * @returns */ static sum(vector: Vector2, vector2: Vector2, dest?: Vector2): Vector2; /** * Subtracts two vectors. * If no dest vector is specified, a new vector is instantiated. * @param vector * @param vector2 * @param dest - An optional destination Vector2. * @returns */ static difference(vector: Vector2, vector2: Vector2, dest?: Vector2): Vector2; /** * Multiplies two vectors piecewise. * If no dest vector is specified, a new vector is instantiated. * @param vector * @param vector2 * @param dest - An optional destination Vector2. * @returns */ static product(vector: Vector2, vector2: Vector2, dest?: Vector2): Vector2; /** * Divides two vectors piecewise. * If no dest vector is specified, a new vector is instantiated. * @param vector * @param vector2 * @param dest - An optional destination Vector2. * @returns */ static quotient(vector: Vector2, vector2: Vector2, dest?: Vector2): Vector2; /** * Copies the x and y components from the source to the destination. The source and destination must be of the same type. * @param src - The source point. */ copyFrom(src: PIXI.IPointData): this; /** * Copies the x and y components from the source to the destination. The source and destination must be of the same type. * @typeParam T The type of your source, can also be a Vector2. * @param p The source point. * @returns */ copyTo(p: T): T; /** * Set the x and y values. * @param x * @param y * @returns */ set(x: number, y: number): this; set(value?: number): this; /** * Return the absolute values of X and Y. * @param dest - An optional destination Vector2. * @returns */ abs(dest?: Vector2): Vector2; /** * Retrieves the x-component or y-component of the vector. * @param index * @returns */ at(index: number): number; /** * Sets both the x- and y-components of the vector to 0. */ reset(): void; /** * Multiplies both the x- and y-components of a vector by -1. * If no dest vector is specified, the operation is performed in-place. * @param dest - An optional destination Vector2. * @returns */ negate(dest?: Vector2): Vector2; /** * Checks if two vectors are equal, using a threshold to avoid floating-point precision errors. * @param other * @param threshold * @returns */ equals(other: Vector2, threshold?: number): boolean; /** * Returns true if both X & Y are greater than the other Vector2. * @param other * @returns */ greaterThan(other: Vector2): boolean; /** * Returns the distance from the vector to the origin. * @returns */ length(): number; /** * Returns the distance from the vector to the origin, squared. * @returns */ squaredLength(): number; /** * Adds two vectors together. * If no dest vector is specified, the operation is performed in-place. * @param vector * @param dest - An optional destination Vector2. * @returns */ add(vector: Vector2, dest?: Vector2): Vector2; /** * Subtracts one vector from another. * If no dest vector is specified, the operation is performed in-place. * @param vector * @param dest - An optional destination Vector2. * @returns */ subtract(vector: Vector2, dest?: Vector2): Vector2; /** * Multiplies two vectors together piecewise. * If no dest vector is specified, the operation is performed in-place. * @param vector * @param dest - An optional destination Vector2. * @returns */ multiply(vector: Vector2, dest?: Vector2): Vector2; /** * Divides two vectors piecewise. * @param vector * @param dest - An optional destination Vector2. * @returns */ divide(vector: Vector2, dest?: Vector2): Vector2; /** * Scales a vector by a scalar parameter. * If no dest vector is specified, the operation is performed in-place. * @param value * @param dest - An optional destination Vector2. * @returns */ scale(value: number, dest?: Vector2): Vector2; /** * Normalizes a vector. * If no dest vector is specified, the operation is performed in-place. * @param dest - An optional destination Vector2. * @returns */ normalize(dest?: Vector2): Vector2; /** * Returns a deep clone this Vector. * If no dest vector is specified, the operation is performed in-place. * @param dest - An optional destination Vector2. * @returns - The resulting deep clone. */ deepClone(dest?: Vector2): Vector2; toJSON(): { x: number; y: number; }; toString(): string; /** * Convert this Vector to an ObservableVector2. * @param callback - Callback of the observableVector2. * @param scope - Scope of the ObservableVector2. * @returns - An ObservableVector2. */ toObservable(callback: (this: T) => any, scope: T): ObservableVector2; }