Copperfield Engine 0.1
C++ Game Engine
Loading...
Searching...
No Matches
math_utils.h
1#ifndef __MATHUTILS_H__
2#define __MATHUTILS_H__ 1
3
4#include <math.h>
5
6namespace coma {
7static constexpr float pi = 3.14159265358979323846f;
8static float Clamp(float value, float minVal, float maxVal);
9static float Radians(float degrees);
10
11inline float Clamp(const float value, const float minVal, const float maxVal) {
12 if (value >= maxVal) {
13 return maxVal;
14 }
15 if (value <= minVal) {
16 return minVal;
17 }
18 return value;
19}
20
21inline float Radians(float degrees) {
22 return degrees * (pi/180.0f);
23}
24} // namespace coma
25#endif
copperdielf Math Library
Definition: buffer.hpp:5