22#ifndef PHOENIXVR_MATH_H
23#define PHOENIXVR_MATH_H
25#include "common/scummsys.h"
28static constexpr auto kTau =
static_cast<float>(M_PI * 2);
29static constexpr auto kPi =
static_cast<float>(M_PI);
30static constexpr auto kPi2 =
static_cast<float>(M_PI_2);
32inline float toRadian(
float deg) {
33 return kPi * deg / 180;
36inline float toAngle(
int a) {
37 static const float angleToFloat = kPi / 4096.0f;
38 return angleToFloat *
static_cast<float>(a);
41inline int fromAngle(
float a) {
42 if (a == INFINITY || a == -INFINITY)
44 static const float floatToAngle = 4096.0f / kPi;
45 return static_cast<int>(floatToAngle * a);