UNPKG

2.08 kBTypeScriptView Raw
1import { MatrixArray } from './matrix';
2export declare type VectorArray = number[];
3export declare function create(x?: number, y?: number): VectorArray;
4export declare function copy<T extends VectorArray>(out: T, v: VectorArray): T;
5export declare function clone(v: VectorArray): VectorArray;
6export declare function set<T extends VectorArray>(out: T, a: number, b: number): T;
7export declare function add<T extends VectorArray>(out: T, v1: VectorArray, v2: VectorArray): T;
8export declare function scaleAndAdd<T extends VectorArray>(out: T, v1: VectorArray, v2: VectorArray, a: number): T;
9export declare function sub<T extends VectorArray>(out: T, v1: VectorArray, v2: VectorArray): T;
10export declare function len(v: VectorArray): number;
11export declare const length: typeof len;
12export declare function lenSquare(v: VectorArray): number;
13export declare const lengthSquare: typeof lenSquare;
14export declare function mul<T extends VectorArray>(out: T, v1: VectorArray, v2: VectorArray): T;
15export declare function div<T extends VectorArray>(out: T, v1: VectorArray, v2: VectorArray): T;
16export declare function dot(v1: VectorArray, v2: VectorArray): number;
17export declare function scale<T extends VectorArray>(out: T, v: VectorArray, s: number): T;
18export declare function normalize<T extends VectorArray>(out: T, v: VectorArray): T;
19export declare function distance(v1: VectorArray, v2: VectorArray): number;
20export declare const dist: typeof distance;
21export declare function distanceSquare(v1: VectorArray, v2: VectorArray): number;
22export declare const distSquare: typeof distanceSquare;
23export declare function negate<T extends VectorArray>(out: T, v: VectorArray): T;
24export declare function lerp<T extends VectorArray>(out: T, v1: VectorArray, v2: VectorArray, t: number): T;
25export declare function applyTransform<T extends VectorArray>(out: T, v: VectorArray, m: MatrixArray): T;
26export declare function min<T extends VectorArray>(out: T, v1: VectorArray, v2: VectorArray): T;
27export declare function max<T extends VectorArray>(out: T, v1: VectorArray, v2: VectorArray): T;