import { Vector } from "./vector"; /** * A vertex (or point) in two dimensional space. */ export declare class Vertex { /** * The precision threshold for comparing vertices. If the difference in axis coordinates between two vertices are both less * than this value, they are considered to be equivalent. This is to mitigate small error margins that are to be expected for * floating point operations. */ static PRECISION_THRESHOLD: number; /** * The x-coordinate of the vertex. */ x: number; /** * The y-coordinate of the vertex. */ y: number; /** * Constructs a vertex with specified coordinates. * @param x The x-coordinate of the vertex, 0 by default. * @param y The y-coordinate of the vertex, 0 by default. */ constructor(x?: number, y?: number); /** * Constructs a new Vertex object with the same properties of this one. * @returns A new Vertex object. */ copy(): Vertex; /** * Creates a user-friendly formatted string for the vertex. Elements are contained in parenthesis, separated by * commas and formatted with 3 decimal digits. * @returns A formatted string representing the vertex. */ toString(): string; /** * Converts this vertex to a vector with x and y proportions equal to the vertex coordinates. * @returns This vertex as a vector. */ toVector(): Vector; /** * Translates the vertex by some amount along both axes. * @param x The translation along the x-axis, 0 by default. * @param y The translation along the y-axis, 0 by default. * @returns The vertex after translation. */ translate(x?: number, y?: number): Vertex; /** * Translates a vertex by some amount along both axes. * @param vertex The vertex to translate. * @param x The translation along the x-axis, 0 by default. * @param y The translation along the y-axis, 0 by default. * @returns A new translated vertex. */ static translate(vertex: Vertex, x?: number, y?: number): Vertex; /** * Scales the distance between the vertex and some control point. * @param factor The scaling factor. * @param control The point from which to scale the vertex, the origin by default. * @returns The vertex after scaling. */ scale(factor: number, control?: Vertex): Vertex; /** * Scales the distance between a vertex and some control point. * @param vertex The vertex to scale. * @param factor The scaling factor. * @param control The point from which to scale the vertex, the origin by default. * @returns A new scaled vertex. */ static scale(vertex: Vertex, factor: number, control?: Vertex): Vertex; /** * Rotates the vertex around some control point. * @param angle The amount to rotate the vertex by in radians. * @param control The point from which to rotate the vertex, the origin by default. * @returns The vertex after rotation. */ rotate(angle: number, control?: Vertex): Vertex; /** * Rotates a vertex around some control point. * @param vertex The vertex to rotate. * @param angle The amount to rotate the vertex by in radians. * @param control The point from which to rotate the vertex, the origin by default. * @returns A new rotated vertex. */ static rotate(vertex: Vertex, angle: number, control?: Vertex): Vertex; /** * Reflects the vertex along an axis projected from some control point. * @param axis The axis along which to reflect the vertex. * @param control The point from which to project the axis for reflection, the origin by default. * @returns The vertex after reflection. */ reflect(axis: Vector, control?: Vertex): Vertex; /** * Reflects a vertex along an axis projected from some control point. * @param vertex The vertex to reflect. * @param axis The axis along which to reflect the vertex. * @param control The point from which to project the axis for reflection, the origin by default. * @returns A new reflected vertex. */ static reflect(vertex: Vertex, axis: Vector, control?: Vertex): Vertex; /** * Calculates the distance from this to another vertex. * @param vertex The vertex to calculate the distance to. * @returns The distance to the other vertex. */ distanceTo(vertex: Vertex): number; /** * Calculates the distance between two vertices. * @param vertexA The first vertex. * @param vertexB The second vertex. * @returns The distance between the vertices. */ static distanceBetween(vertexA: Vertex, vertexB: Vertex): number; /** * Calculates the angle from this to another vertex, with respect to a reference heading. * @param vertex The vertex to calculate the angle to. * @param heading The reference heading angle from this vertex measured in radians from the positive x-axis, 0 radians by default. * @returns The angle to the other vertex. */ angleTo(vertex: Vertex, heading: number): number; /** * Determines whether this vertex is equivalent to another vertex. Vertices are considered equivalent if the difference in * their axis coordinates are both less than the PRECISION_THRESHOLD set for the Vertex class. * @param vertex The vertex to compare to this one. * @returns True if the this vertex is equivalent to the other vertex, false otherwise. */ isEquivalentTo(vertex: Vertex): Boolean; /** * Calculates the angle between two vertices. * @param vertexA The first vertex. * @param vertexB The second vertex. * @param heading The reference heading angle from the first vertex measured in radians from the positive x-axis, 0 radians by default. * @returns The angle between the vertices. */ static angleBetween(vertexA: Vertex, vertexB: Vertex, heading: number): number; /** * Calculates the arithmetic mean vertex of a collection of vertices. * @param vertices The vertices to calculate the arithmetic mean for as an array. * @returns The arithmetic mean vertex of the vertices. */ static mean(vertices: Vertex[]): Vertex; } /** * Shorthand constructor for a Vertex object. * @param x The x-coordinate of the vertex, 0 by default. * @param y The y-coordinate of the vertex, 0 by default. * @returns A new Vertex instance. */ export declare function vtx(x?: number, y?: number): Vertex;