import { Vertex } from "./vertex"; /** * Describes a vector in 2-dimensional space. */ export declare class Vector { /** * The proportion of the vector in the x-dimension. */ x: number; /** * The proportion of the vector in the y-dimension. */ y: number; /** * Constructs a vector with specified dimension proportions. * @param x The proportion of the vector in the x-dimension, 0 by default. * @param y The proportion of the vector in the y-dimension, 0 by default. */ constructor(x?: number, y?: number); /** * Creates a new Vector object with the same properties of this one. * @returns A new Vector object. */ copy(): Vector; /** * Creates a user-friendly formatted string for the vector. Elements are contained in angle braces, separated by * commas and formatted with 3 decimal digits. * @returns A formatted string representing the vector. */ toString(): string; /** * Converts this vector to a vertex with x and y coordinates equal to the vector proportions. * @returns This vector as a vertex. */ toVertex(): Vertex; /** * Converts an angle to be between 0 and 2 PI. * @param angle The angle to convert. */ private static standardizeAngle; /** * Returns a unit vector at a specified angle. * @param angle The angle from the positive x-axis in radians. * @returns A unit vector. */ static unit(angle: number): Vector; /** * Calculates the magnitude (length) of the vector. * @returns The magtiude (length) of the vector. */ magnitude(): number; /** * Calculates the angle the vector makes with the positive x-axis. * @returns The angle in radians. */ angle(): number; /** * Calculates the dot (scalar) product of this and another vector. * @param other The vector to calculate the dot product with. * @returns The dot product of the two vectors. */ dot(other: Vector): number; /** * Calculates the magnitude of the cross (vector) product of this and another vector. * @param other The vector to calculate the cross product with. * @returns The magnitude of the cross product of the two vectors. */ cross(other: Vector): number; /** * Calculates the angle this vector makes with another vector. The angle between the two vectors is always assumed * to be measured counter-clockwise from this vector. * @param other The vector the calculate the angle to. * @returns The angle in radians. */ angleBetween(other: Vector): number; /** * Adds the proportions of another vector to this one. * @param other The vector with proportions to add to this one. * @returns The sum of the vectors. */ add(other: Vector): Vector; /** * Adds the proportions of two vectors. * @param vectorA The vector to add to. * @param vectorB The vector to add. * @returns The sum of the vectors. */ static add(vectorA: Vector, vectorB: Vector): Vector; /** * Subtracts the proportions of another vector from this one. * @param other The vector with proportions to subtract from this one. * @returns The difference of the vectors. */ subtract(other: Vector): Vector; /** * Subtracts the proportions of two vectors. * @param vectorA The vector to subtract from. * @param vectorB The vector to subtract. * @returns The difference of the vectors. */ static subtract(vectorA: Vector, vectorB: Vector): Vector; /** * Scales the vector by some amount. * @param factor The amount to scale the vector by. * @returns This vector after scaling. */ scale(factor: number): Vector; /** * Scales a vector by some amount. * @param vector The vector to scale. * @param factor The amount to scale the vector by. * @returns A new scaled vector. */ static scale(vector: Vector, factor: number): Vector; /** * Normalizes the vector (scales its magnitude to 1). * @returns This vector after normalization. */ normalize(): Vector; /** * Normalizes a vector (scales its magnitude to 1). * @param vector The vector to normalize. * @returns A new normalized vector. */ static normalize(vector: Vector): Vector; /** * Rotates the vector by some angle. * @param angle The amount to rotate the vector by in radians. * @returns The vector after rotation. */ rotate(angle: number): Vector; /** * Rotates a vector by some angle. * @param vector The vector to rotate. * @param angle The amount to rotate the vector by in radians. * @returns A new rotated vector */ static rotate(vector: Vector, angle: number): Vector; /** * Reflects the vector along an axis defined by some vector. * @param axis The axis along which to reflect the vector. * @returns The vector after reflection. */ reflect(axis: Vector): Vector; /** * Reflects a vector along an axis defined by some vector. * @param vector The vector to reflect. * @param axis The axis along which to reflect the vector. * @returns A new reflected vector */ static reflect(vector: Vector, axis: Vector): Vector; } /** * Shorthand constructor for a Vector object. * @param x The proportion of the vector in the x-dimension, 0 by default. * @param y The proportion of the vector in the y-dimension, 0 by default. * @returns A new Vector instance. */ export declare function vec(x?: number, y?: number): Vector;