ES-DE/es-core/src/math/Misc.h

37 lines
1.4 KiB
C
Raw Normal View History

2017-11-06 10:46:15 +00:00
#pragma once
#ifndef ES_CORE_MATH_MISC_H
#define ES_CORE_MATH_MISC_H
#define ES_PI (3.1415926535897932384626433832795028841971693993751058209749445923)
2017-11-22 21:29:52 +00:00
#define ES_RAD_TO_DEG(_x) ((_x) * (180.0 / ES_PI))
#define ES_DEG_TO_RAD(_x) ((_x) * (ES_PI / 180.0))
2017-11-06 10:46:15 +00:00
namespace Math
{
2017-11-13 22:16:38 +00:00
// added here to avoid including math.h whenever these are used
2017-11-22 21:29:52 +00:00
float cosf (const float _num);
float sinf (const float _num);
float floorf (const float _num);
float ceilf (const float _num);
2017-11-06 10:46:15 +00:00
2017-11-22 21:29:52 +00:00
int min (const int _num1, const int _num2);
int max (const int _num1, const int _num2);
float min (const float _num1, const float _num2);
float max (const float _num1, const float _num2);
float clamp (const float _num, const float _min, const float _max);
float round (const float _num);
float lerp (const float _start, const float _end, const float _fraction);
float smoothStep (const float _left, const float _right, const float _x);
2017-11-13 22:16:38 +00:00
float smootherStep(const float _left, const float _right, const float _x);
2017-11-22 21:29:52 +00:00
2017-11-13 22:16:38 +00:00
namespace Scroll
2017-11-06 10:46:15 +00:00
{
2017-11-17 14:58:52 +00:00
float bounce(const float _delayTime, const float _scrollTime, const float _currentTime, const float _scrollLength);
2017-11-22 21:29:52 +00:00
float loop (const float _delayTime, const float _scrollTime, const float _currentTime, const float _scrollLength);
2017-11-13 22:16:38 +00:00
} // Math::Scroll::
2017-11-06 10:46:15 +00:00
2017-11-13 22:16:38 +00:00
} // Math::
2017-11-06 10:46:15 +00:00
#endif // ES_CORE_MATH_MISC_H