Skip to content

Commit 078383c

Browse files
committed
feat: enhance utils
1 parent 0806fbf commit 078383c

File tree

1 file changed

+4
-4
lines changed
  • packages/pixel-profile/src/utils

1 file changed

+4
-4
lines changed

packages/pixel-profile/src/utils/math.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ export function add2(a: Vec2, b: Vec2): Vec2 {
1414
return [a[0] + b[0], a[1] + b[1]]
1515
}
1616

17+
export function subtract2(a: Vec2, b: Vec2): Vec2 {
18+
return [a[0] - b[0], a[1] - b[1]]
19+
}
20+
1721
export function dot2(a: Vec2, b: Vec2): number {
1822
return a[0] * b[0] + a[1] * b[1]
1923
}
2024

2125
export function prod2(v: Vec2): number {
2226
return v[0] * v[1]
2327
}
24-
25-
export function subtract2(vec1: Vec2, vec2: Vec2): Vec2 {
26-
return [vec1[0] - vec2[0], vec1[1] - vec2[1]]
27-
}

0 commit comments

Comments
 (0)