Working version of train following spline path

This commit is contained in:
Emma
2023-02-07 08:36:58 -07:00
commit f1c991bd3e
17 changed files with 2350 additions and 0 deletions

8
math/lerp.ts Normal file
View File

@@ -0,0 +1,8 @@
import { Vector } from "./vector.ts";
export const lerp = (a: number, b: number, t: number) => {
return (a*t) + (b*(1-t));
}
export const map = (value: number, x1: number, y1: number, x2: number, y2: number) =>
(value - x1) * (y2 - x2) / (y1 - x1) + x2;