Added a new method for calculating the gesture triangle shape
and moved gesture data to a separate file
This commit is contained in:
parent
8f1bcf3806
commit
3c204377d6
File diff suppressed because it is too large
Load Diff
1444
src/helpers/gesturesData.js
Normal file
1444
src/helpers/gesturesData.js
Normal file
File diff suppressed because it is too large
Load Diff
20
src/helpers/vector2.js
Normal file
20
src/helpers/vector2.js
Normal file
@ -0,0 +1,20 @@
|
||||
export function lengthSquared(p) {
|
||||
return p.x * p.x + p.y * p.y;
|
||||
}
|
||||
|
||||
export function length(p) {
|
||||
return Math.sqrt(lengthSquared(p));
|
||||
}
|
||||
|
||||
export function normalize(p) {
|
||||
const l = length(p);
|
||||
return { x: p.x / l, y: p.y / l };
|
||||
}
|
||||
|
||||
export function dot(a, b) {
|
||||
return a.x * b.x + a.y * b.y;
|
||||
}
|
||||
|
||||
export function subtract(a, b) {
|
||||
return { x: a.x - b.x, y: a.y - b.y };
|
||||
}
|
Loading…
Reference in New Issue
Block a user