life: improve performance

This commit is contained in:
2025-08-05 10:16:25 +02:00
parent 180f50bdf6
commit ab38071ffe
2 changed files with 37 additions and 32 deletions

View File

@@ -3,6 +3,17 @@ export interface Point {
y: number;
}
export const DIRECTIONS: Point[] = [
{ x: 0, y: -1}, // N
{ x: -1, y: -1}, // NW
{ x: 1, y: -1}, // NE
{ x: -1, y: 0}, // W
{ x: 1, y: 0}, // E
{ x: 0, y: 1}, // S
{ x: -1, y: 1}, // SW
{ x: 1, y: 1}, // SE
];
export function lerp(a: Point, b: Point, p: number) {
return {
x: a.x + (b.x - a.x) * p,