Make physics more fun
This commit is contained in:
parent
155e360c8e
commit
89fafeafd3
41 changed files with 511 additions and 334 deletions
9
backend/src/helper/interpolate-angles.ts
Normal file
9
backend/src/helper/interpolate-angles.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
const shortAngleDist = (a0: number, a1: number): number => {
|
||||
const max = Math.PI * 2;
|
||||
const da = (a1 - a0) % max;
|
||||
return ((2 * da) % max) - da;
|
||||
};
|
||||
|
||||
export const interpolateAngles = (a0: number, a1: number, t: number) => {
|
||||
return a0 + shortAngleDist(a0, a1) * t;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue