UNPKG

ts-scikit

Version:

A scientific toolkit written in Typescript

48 lines (47 loc) 1.61 kB
import { Tuple2 } from './tuple2'; import { Vector2 } from './vector2'; /** * A point with 2 coordinates: x and y. */ export declare class Point2 extends Tuple2 { constructor(x: number, y: number); /** * Returns the point q = p + v for this point p and the specified vector v. * @param v the vector v. * @returns the point q = p + v. */ plus(v: Vector2): Point2; /** * Moves this point p by adding the specified vector v. * @param v the vector v. * @returns a reference to this point, moved along vector v. */ plusEquals(v: Vector2): this; /** * Returns the point or vector q = p - v for this point p. * If v is a vector, q is a point translated along vector v. * If v is a point, q is the vector difference. * @param v the point or vector v. * @returns the vector or point q = p - v. */ minus(v: Vector2 | Point2): Point2 | Vector2; /** * Moves this point by subtracting the specified vector v * @param v the vector v. * @returns a reference to this point, moved along vector v. */ minusEquals(v: Vector2): this; /** * Returns an affine combination of this point p and the specified point q. * @param a the weight of the point q. * @param q the point q. * @returns the affine combination (1 - a) * p + a * q. */ affine(a: number, q: Point2): Point2; /** * Computes the distance between this point p and the specified point q. * @param q the point q. * @returns the distance |q - p|. */ distanceTo(q: Point2): number; }