import { Mat3 } from './mat3'; import { Vec3 } from './vec3'; /** * Class representing a two-dimensional Vector with properties x and y and providing static utilities for mathematical operations */ export declare class Vec2 { readonly x: number; readonly y: number; /** * Add two Vec2s * * @param left the first Vec2 * @param right the second Vec2 * * @returns the result of the addition */ static add(left: Vec2, right: Vec2): Vec2; /** * Subtract the right Vec2 from the left * * @param left the Vec2 to subtract from * @param right the Vec2 to subtract * * @returns the result of the subtraction */ static sub(left: Vec2, right: Vec2): Vec2; /** * Multiply two Vec2s * * @param left the first Vec2 * @param right the second Vec2 * * @returns the result of the multiplication */ static mult(left: Vec2, right: Vec2): Vec2; /** * Divide the left Vec2 by the right * * @param left the Vec2 to divide * @param right the Vec2 to divide by * * @returns the result of the division */ static div(left: Vec2, right: Vec2): Vec2; /** * Scale a Vec2 by a given factor * * @param v the Vec2 to scale * @param factor the factor to scale by * * @returns the scaled Vec2 */ static scale(v: Vec2, factor: number): Vec2; /** * Negate a Vec2 * * @param v the Vec2 to negate * * @returns the negated Vec2 */ static negate(v: Vec2): Vec2; /** * Invert a Vec2 * * @param v the Vec2 to invert * * @returns the inverse of the Vec2 */ static invert(v: Vec2): Vec2; /** * Normalize a Vec2 * * @param v the Vec2 to normalize * * @returns the normalized Vec2 */ static normalize(v: Vec2): Vec2; /** * Calculate the dot product of two Vec2s * * @param left the first Vec2 * @param right the second Vec2 * * @returns the dot product of the two Vec2s */ static dot(left: Vec2, right: Vec2): number; /** * Calculate the cross product of two Vec2s * * @param left the first Vec2 * @param right the second Vec2 * * @returns the cross product of the two Vec2s (a Vec3) */ static cross(left: Vec2, right: Vec2): Vec3; /** * Calculate the distance between two Vec2s * * @param left the first Vec2 * @param right the second Vec2 * * @returns the distance between the two Vec2s */ static distanceBetween(left: Vec2, right: Vec2): number; /** * Calculate the angle between two Vec2s * * @param left the first Vec2 * @param right the second Vec2 * * @returns the angle between the two Vec2s (radians) */ static angleBetween(left: Vec2, right: Vec2): number; /** * Rotate a Vec2 by a given angle (radians) * * @param v the Vec2 to rotate * @param angle the angle to rotate by * * @returns the rotated Vec2 */ static rotate(v: Vec2, angle: number): Vec2; /** * Clamp the components of a given Vec2 to between the components of the given min and max * * @param v the Vec2 to clamp * @param min the Vec2 representing the minimum x and y values for v * @param max the Vec2 representing the maximum x and y values for v * * @returns the clamped Vec2 */ static clamp(v: Vec2, min: Vec2, max: Vec2): Vec2; /** * Transform a Vec2 by a given Mat3 transformation matrix * * @param v the Vec2 to transform * @param m the Mat3 to transform by * * @returns the transformed Vec2 */ static transformByMat3(v: Vec2, m: Mat3): Vec2; /** * Constructor. Take and store the Vec2's x and y properties * * @param x the Vec2's x; defaults to 0 * @param y the Vec2's y; defaults to 0 */ constructor(x?: number, y?: number); /** * Getter for the Vec2's magnitude */ get magnitude(): number; /** * Getter for the Array form of the Vec2 */ get array(): Array; /** * Getter for the Float32Array form of the Vec2 */ get float32Array(): Float32Array; /** * Getter for the readable string form of the Vec2 */ get string(): string; /** * Set the Vec2's x and y to the given values * * @param x the new x; defaults to 0 * @param y the new y; defaults to 0 */ set(x?: number, y?: number): void; /** * Set the Vec2's x to the given value * * @param x the new x; defaults to 0 */ setX(x?: number): void; /** * Set the Vec2's y to the given value * * @param y the new y; defaults to 0 */ setY(y?: number): void; /** * Clone the Vec2 * * @returns a new Vec2 with the same x and y as this one */ clone(): Vec2; /** * Getter for a Mutable cast of the Vec2 instance; used for enabling internal-only mutation in the set*() methods * * @returns the typecasted Mutable Vec2 instance */ private get mutable(); }