UNPKG

dabbjs

Version:

general javascript library

58 lines (57 loc) 1.33 kB
import { IPoint } from "../lib/interfaces"; export declare class Vector2D { x: number; y: number; constructor(x: number, y: number); /** * returns the length of the vector */ length(): number; /** * returns DOT product of these vectors * @param v vector 2d */ dot(v: IPoint): number; /** * returns the Determinant of these vectors * @param v vector 2d */ det(v: IPoint): number; /** * returns the angle between these two vectors * @param v vector 2d */ angleTo(v: IPoint): number; /** * returns the vector addition * @param v vector2d or number */ add(v: IPoint | number): Vector2D; /** * returns the vector subtraction * @param v vector2d or number */ sub(v: IPoint | number): Vector2D; /** * returns the vector multiplication * @param v vector2d or number */ mul(v: IPoint | number): Vector2D; /** * returns the vector division * @param v vector2d or number */ div(v: IPoint | number): Vector2D; /** * returns the Unit vector */ unit(): Vector2D; /** * returns a clone of this vector */ clone(): Vector2D; /** * returns the XY plane origin/empty vector */ static empty(): Vector2D; }