mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-30 02:31:40 +00:00
Improve UI stability, reliability, and readability (#1104)
closes #1090 closes #1030 Also fixes various styling issues and overflow issues for mobile support
This commit is contained in:
13
photon-client/src/lib/MathUtils.ts
Normal file
13
photon-client/src/lib/MathUtils.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export const mean = (values: number[]): number | undefined => {
|
||||
if (values.length === 0) return undefined;
|
||||
return values.reduce((acc, num) => acc + num, 0) / values.length;
|
||||
};
|
||||
|
||||
export const angleModulus = (valueRad: number): number => {
|
||||
while (valueRad < -Math.PI) valueRad += Math.PI * 2;
|
||||
while (valueRad > Math.PI) valueRad -= Math.PI * 2;
|
||||
return valueRad;
|
||||
};
|
||||
|
||||
export const toDeg = (val: number) => val * (180.0 / Math.PI);
|
||||
export const toRad = (val: number) => val * (Math.PI / 180.0);
|
||||
Reference in New Issue
Block a user