vector.d.ts 2.0 KB

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