Simulant  21.12-1292
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
radians.h
1 #pragma once
2 
3 namespace smlt {
4 
5 struct Degrees;
6 
7 struct Radians {
8 private:
9  float value_ = 0.0f;
10 
11 public:
12  Radians():
13  value_(0) {}
14 
15  explicit Radians(float value):
16  value_(value) {}
17 
18  Radians(const Degrees& rhs);
19 
20  template<typename T>
21  bool operator<(T value) const {
22  return value_ < value;
23  }
24 
25  template<typename T>
26  bool operator<=(T value) const {
27  return value_ <= value;
28  }
29 
30  template<typename T>
31  bool operator>(T value) const {
32  return value_ > value;
33  }
34 
35  template<typename T>
36  bool operator>=(T value) const {
37  return value_ >= value;
38  }
39 
40  float to_float() const {
41  return value_;
42  }
43 
44  Degrees to_degrees() const;
45 
46  Radians operator*(float scalar) const {
47  return Radians(to_float() * scalar);
48  }
49 
50  Radians& operator*=(float scalar) {
51  value_ *= scalar;
52  return *this;
53  }
54 };
55 
56 Radians lerp_angle(Radians a, Radians b, float t);
57 
58 typedef Radians Rad;
59 }
60 
61 smlt::Radians operator""_rad(long double v);
smlt::Radians
Definition: radians.h:7
smlt
Definition: animation.cpp:25
smlt::Degrees
Definition: degrees.h:13