UNPKG

865 BTypeScriptView Raw
1export type Vector2 = [number, number];
2export declare function sub([x1, y1]: Vector2, [x2, y2]: Vector2): Vector2;
3export declare function add([x1, y1]: Vector2, [x2, y2]: Vector2): Vector2;
4export declare function dist([x0, y0]: Vector2, [x1, y1]: Vector2): number;
5/**
6 * Calculate angle of vector [x, y].
7 */
8export declare function angle([x, y]: Vector2): number;
9/**
10 * Calculate angle of [x, y], then + Math.PI / 2.
11 * Because of the difference between `Geometric coordinate system` and `Visualization coordinate system`.
12 * @returns
13 */
14export declare function angleWithQuadrant([x, y]: Vector2): number;
15export declare function angleBetween(v0: Vector2, v1: Vector2): number;
16export declare function calcBBox(points: Vector2[]): number[];
17/**
18 * Get the center of two points.
19 */
20export declare function mid([x1, y1]: Vector2, [x2, y2]: Vector2): Vector2;