29 #ifndef THOR_TRIGONOMETRY_HPP
30 #define THOR_TRIGONOMETRY_HPP
75 static Type sin(Type deg) {
return std::sin(degToRad(deg)); }
76 static Type cos(Type deg) {
return std::cos(degToRad(deg)); }
77 static Type tan(Type deg) {
return std::tan(degToRad(deg)); }
78 static Type arcSin(Type value) {
return radToDeg(std::asin(value)); }
79 static Type arcCos(Type value) {
return radToDeg(std::acos(value)); }
80 static Type arcTan2(Type valY, Type valX) {
return radToDeg(std::atan2(valY, valX)); }
81 static Type sqrt(Type value) {
return std::sqrt(value); }
83 static Type pi() {
return 3.141592653589793238462643383f; }
84 static Type radToDeg(Type rad) {
return 180 / pi() * rad; }
85 static Type degToRad(Type deg) {
return pi() / 180 * deg; }
90 struct TrigonometricTraits<double>
94 static Type sin(Type deg) {
return std::sin(degToRad(deg)); }
95 static Type cos(Type deg) {
return std::cos(degToRad(deg)); }
96 static Type tan(Type deg) {
return std::tan(degToRad(deg)); }
97 static Type arcSin(Type value) {
return radToDeg(std::asin(value)); }
98 static Type arcCos(Type value) {
return radToDeg(std::acos(value)); }
99 static Type arcTan2(Type valY, Type valX) {
return radToDeg(std::atan2(valY, valX)); }
100 static Type sqrt(Type value) {
return std::sqrt(value); }
102 static Type pi() {
return 3.141592653589793238462643383; }
103 static Type radToDeg(Type rad) {
return 180 / pi() * rad; }
104 static Type degToRad(Type deg) {
return pi() / 180 * deg; }
109 struct TrigonometricTraits<long double>
111 typedef long double Type;
113 static Type sin(Type deg) {
return std::sin(degToRad(deg)); }
114 static Type cos(Type deg) {
return std::cos(degToRad(deg)); }
115 static Type tan(Type deg) {
return std::tan(degToRad(deg)); }
116 static Type arcSin(Type value) {
return radToDeg(std::asin(value)); }
117 static Type arcCos(Type value) {
return radToDeg(std::acos(value)); }
118 static Type arcTan2(Type valY, Type valX) {
return radToDeg(std::atan2(valY, valX)); }
119 static Type sqrt(Type value) {
return std::sqrt(value); }
121 static Type pi() {
return 3.141592653589793238462643383l; }
122 static Type radToDeg(Type rad) {
return 180 / pi() * rad; }
123 static Type degToRad(Type deg) {
return pi() / 180 * deg; }
131 template <
typename T>
139 template <
typename T>
147 extern const float THOR_API
Pi;
153 #endif // THOR_TRIGONOMETRY_HPP
Trigonometric traits template.
Definition: Trigonometry.hpp:65
const float Pi
The number Pi (3.1415...)
Definition: AnimationMap.hpp:42
Configuration header of the library.
T toDegree(T radian)
Converts radians to degrees.
Definition: Trigonometry.hpp:132
T toRadian(T degree)
Converts degrees to radians.
Definition: Trigonometry.hpp:140