CommonLibSSE (powerof3)
NiMath.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace RE
4 {
5  constexpr float NI_INFINITY = FLT_MAX;
6  constexpr float NI_PI = static_cast<float>(3.1415926535897932);
7  constexpr float NI_HALF_PI = 0.5F * NI_PI;
8  constexpr float NI_TWO_PI = 2.0F * NI_PI;
9 
10  inline float deg_to_rad(float a_degrees)
11  {
12  return a_degrees * (NI_PI / 180.0f);
13  }
14 
15  inline float rad_to_deg(float a_radians)
16  {
17  return a_radians * (180.0f / NI_PI);
18  }
19 
20  inline float normalize_angle(float a_radians)
21  {
22  float a = std::fmodf(a_radians + NI_PI, 2 * NI_PI);
23  return a >= 0.0f ? (a - NI_PI) : (a + NI_PI);
24  }
25 
26  float NiAbs(float a_value);
27  float NiASin(float a_value);
28  float NiFastATan2(float a_y, float a_x);
29 }
Definition: AbsorbEffect.h:6
float NiAbs(float a_value)
float normalize_angle(float a_radians)
Definition: NiMath.h:20
float NiASin(float a_value)
float deg_to_rad(float a_degrees)
Definition: NiMath.h:10
constexpr float NI_INFINITY
Definition: NiMath.h:5
float NiFastATan2(float a_y, float a_x)
constexpr float NI_HALF_PI
Definition: NiMath.h:7
float rad_to_deg(float a_radians)
Definition: NiMath.h:15
constexpr float NI_TWO_PI
Definition: NiMath.h:8
constexpr float NI_PI
Definition: NiMath.h:6