import type { Point2d } from './types.ts'; /** * Operations with two-dimensional vector. */ export declare class Vector2 implements Point2d { /** Coordinate in x axis. */ x: number; /** Coordinate in y axis. */ y: number; /** * Vector2 constructor. * @param x X coordinate. * @param y Y coordinate. */ constructor(x: number, y: number); /** * Takes coordinates and returns vector. * @param x X coordinate. * @param y Y coordinate. * @returns Vector. */ static of(x?: number, y?: number): Vector2; /** * Returns vector from point-like interface. * @param source Point-like interface. * @returns Vector. */ static from(source: T): Vector2; /** * Returns plain object with coordinates of vector. * @returns Plain object. */ toJSON(): Point2d; /** * Returns new instance of Vector2 with same x and y. * @returns New instance. */ clone(): Vector2; /** * Copies coordinates from given vector. * @param vector Vector. * @returns This. */ copy(vector: Point2d): this; /** * Sets the X coordinate. * @param x X coordinate. * @returns This. */ setX(x: number): this; /** * Sets the Y coordinate. * @param y Y coordinate. * @returns This. */ setY(y: number): this; /** * Adds value to the X coordinate. * @param x X coordinate. * @returns This. */ addX(x: number): this; /** * Adds value to the Y coordinate. * @param y Y coordinate. * @returns This. */ addY(y: number): this; /** * Subtracts value to the X coordinate. * @param x X coordinate. * @returns This. */ subX(x: number): this; /** * Subtracts value to the Y coordinate. * @param y Y coordinate. * @returns This. */ subY(y: number): this; /** * Vector addition. * @param vector Vector. * @returns This. */ add(vector: Point2d): this; /** * Vector subtraction. * @param vector Vector. * @returns This. */ subtract(vector: Point2d): this; /** * Multiplies this vector by given vector. * @param vector Vector. * @returns This. */ multiply(vector: Point2d): this; /** * Multiplying a vector by a scalar. * @param scalar Scalar. * @returns This. */ scale(scalar: number): this; /** * Makes length equals to 1. * @returns This. */ normalize(): this; /** * Check that two vectors are equal. * @param vector Vector. * @returns True if vectors are equal, false otherwise. */ equalsTo(vector: Point2d): boolean; /** * Returns distance between two vectors. * @param vector Vector. * @returns Distance. */ getDistance(vector: Point2d): number; /** * Returns length of vector. * @returns Length. */ getLength(): number; /** * Rotates vector around origin. * @param radians Angle in radians. * @returns This. */ rotate(radians: number): this; /** * Rotates vector around given pivot. * @param pivot Pivot. * @param radians Angle in radians. * @returns This. */ rotateAround(pivot: Point2d, radians: number): this; }