@mlightcad/shx-parser
Version:
A TypeScript library for parsing AutoCAD SHX font files
82 lines (81 loc) • 2.83 kB
TypeScript
/**
* Represents a 2D point with x and y coordinates.
*/
export declare class Point {
/** The x-coordinate of the point */
x: number;
/** The y-coordinate of the point */
y: number;
/**
* Creates a new Point instance.
* @param x - The x-coordinate (defaults to 0)
* @param y - The y-coordinate (defaults to 0)
*/
constructor(x?: number, y?: number);
/**
* Sets the coordinates of the point.
* @param x - The new x-coordinate
* @param y - The new y-coordinate
* @returns The point instance for method chaining
*/
set(x: number, y: number): Point;
/**
* Calculates the length (magnitude) of the vector from origin to this point.
* @returns The length of the vector
*/
length(): number;
/**
* Normalizes the point vector to have a length of 1.
* @returns The point instance for method chaining
*/
normalize(): Point;
/**
* Creates a new Point instance with the same coordinates.
* @returns A new Point instance with the same x and y values
*/
clone(): Point;
/**
* Adds another point's coordinates to this point.
* @param point - The point to add
* @returns The point instance for method chaining
*/
add(point: Point): Point;
/**
* Subtracts another point's coordinates from this point.
* @param point - The point to subtract
* @returns The point instance for method chaining
*/
subtract(point: Point): Point;
/**
* Multiplies both coordinates by a scalar value.
* @param scalar - The scalar value to multiply by
* @returns The point instance for method chaining
*/
multiply(scalar: number): Point;
/**
* Divides both coordinates by a scalar value.
* @param scalar - The scalar value to divide by
* @returns The point instance for method chaining
*/
divide(scalar: number): Point;
/**
* Multiplies x and y coordinates by different scalar values.
* @param xScalar - The scalar value to multiply x-coordinate by
* @param yScalar - The scalar value to multiply y-coordinate by
* @returns The point instance for method chaining
*/
multiplyScalars(xScalar: number, yScalar: number): Point;
/**
* Divides x and y coordinates by different scalar values.
* @param xScalar - The scalar value to divide x-coordinate by
* @param yScalar - The scalar value to divide y-coordinate by
* @returns The point instance for method chaining
*/
divideScalars(xScalar: number, yScalar: number): Point;
/**
* Calculates the Euclidean distance to another point.
* @param point - The point to calculate distance to
* @returns The distance between the two points
*/
distanceTo(point: Point): number;
}