export function adjustAngle(theta: number, min: number, max: number) { while (theta < min) theta += Math.PI * 2; while (theta > max) theta -= Math.PI * 2; return theta; }