export enum Direction {
  UP = "UP",
  DOWN = "DOWN",
  LEFT = "LEFT",
  RIGHT = "RIGHT",
  NONE = "NONE",
}

export const angleToDirection = (angle: number): Direction => {
  if (angle >= -Math.PI / 4 && angle < Math.PI / 4) {
    return Direction.RIGHT;
  } else if (angle >= Math.PI / 4 && angle < (3 * Math.PI) / 4) {
    return Direction.DOWN;
  } else if (angle >= (3 * Math.PI) / 4 || angle < -(3 * Math.PI) / 4) {
    return Direction.LEFT;
  } else {
    return Direction.UP;
  }
};
