-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.duplicate
59 lines (50 loc) · 1.33 KB
/
.duplicate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
export const calculateEbob: (a: number, b: number) => number = (a, b) => {
let commonNumber:number[] = [];
switch (b) {
case 0:
case -1:
case 1:
return 1;
}
switch (a) {
case 0:
case -1:
case 1:
return 1;
default:
let number1:number = Math.abs(a);
let number2:number = Math.abs(b);
let i = 2
for (; i < number1 + 1; i++) {
if (number2 % i === 0 && number1 % i === 0) {
commonNumber.push(i);
number1 /= i;
number2 /= i;
i = 2;
}
}
return multiplicationOfArray(commonNumber)
}
}
// If curved, apply bezier otherwise line
/*if (curved) {
if (!beforeRef.current || index === 0) {
context.moveTo(currentPosition.x, currentPosition.y)
beforeRef.current = {
x: currentPosition.x,
y: currentPosition.y
}
} else {
const beforePosition = beforeRef.current as Position;
context.bezierCurveTo(
beforePosition.x,
beforePosition.y,
(currentPosition.x + beforePosition.x) / 2,
(currentPosition.y + beforePosition.y) / 2,
currentPosition.x,
currentPosition.y
)
beforePosition.x = currentPosition.x;
beforePosition.y = currentPosition.y;
}
}*/