1.4 kBTypeScriptView Raw
1export declare function addV<T extends number[]>(v1: T, v2: T): T;
2export declare function subV<T extends number[]>(v1: T, v2: T): T;
3/**
4 * Calculates distance
5 * @param movement the difference between current and initial vectors
6 * @returns distance
7 */
8export declare function calculateDistance(movement: number[]): number;
9interface Kinematics {
10 velocities: number[];
11 velocity: number;
12 distance: number;
13 direction: number[];
14}
15export declare function calculateAllGeometry<T extends number[]>(movement: T, delta?: T): {
16 distance: number;
17 direction: T;
18};
19/**
20 * Calculates all kinematics
21 * @template T the expected vector type
22 * @param movement the difference between current and initial vectors
23 * @param delta the difference between current and previous vectors
24 * @param delta_t the time difference between current and previous timestamps
25 * @returns all kinematics
26 */
27export declare function calculateAllKinematics<T extends number[]>(movement: T, delta: T, dt: number): Kinematics;
28/**
29 * Because IE doesn't support `Math.sign` function, so we use the polyfill version of the function.
30 * This polyfill function is suggested by Mozilla:
31 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign#Polyfill
32 * @param x target number
33 */
34export declare function sign(x: number): number;
35export {};