@learn-hunger/visual-gestures
Version:
VisualGestures.js is a package that empowers users to effortlessly control the cursor, including actions such as hover, click, drag, and drop, through precise finger movements in the air.
19 lines (18 loc) • 1.17 kB
TypeScript
import { EFingers } from "./vg-constants";
import { INormalizedLandmark, TFingersData } from "./vg-types-handlandmarks";
export declare function distance(point1: number, point2: number, pow?: number): number;
export declare function euclideanDistance(point1: number, point2: number, point3?: number): number;
export declare function manhettanDistance(point1: number, point2: number): number;
/**
* Calcuates WeightedEuclideanDistance
* Used to weight x, y-axis based on the context
* To calculate 'palmHeight', 'fingerHeight', and distances in FingerOpenRatio (FOR), 'y' magnitude is weighted more than 'x' magnitude
* To calculate displacement of hand for 'pseudoClick', 'pseudoDrag', 'x' and 'y' magnitudes are weighted the same
*/
export declare function weightedEuclideanDistance(landmark1: INormalizedLandmark, landmark2: INormalizedLandmark, weights?: number[]): number;
/**
* Calculates PiecewiseFingerDistance
* Denominator term in FingerOpenRatio (FOR)
* Corresponds to distance
*/
export declare function piecewiseFingerDistance(fingerData: Omit<TFingersData, "WRIST">, fingerName: Exclude<keyof typeof EFingers, "WRIST">, weights?: number[]): number;