2020-09-21 17:17:34 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-26 15:17:35 +00:00
|
|
|
//
|
2020-09-21 17:17:34 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-26 15:17:35 +00:00
|
|
|
// Misc.h
|
|
|
|
//
|
|
|
|
// Miscellaneous math functions.
|
|
|
|
//
|
|
|
|
|
2017-11-06 10:46:15 +00:00
|
|
|
#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
|
|
|
|
{
|
2020-12-28 10:29:32 +00:00
|
|
|
// When moving to the C++20 standard these functions are no longer required.
|
2020-06-26 15:17:35 +00:00
|
|
|
float clamp(const float _num, const float _min, const float _max);
|
|
|
|
float lerp(const float _start, const float _end, const float _fraction);
|
2020-12-28 10:29:32 +00:00
|
|
|
|
2020-06-26 15:17:35 +00:00
|
|
|
float smoothStep(const float _left, const float _right, const float _x);
|
|
|
|
float smootherStep(const float _left, const float _right, const float _x);
|
2017-11-06 10:46:15 +00:00
|
|
|
|
2020-06-26 15:17:35 +00:00
|
|
|
namespace Scroll
|
|
|
|
{
|
|
|
|
float bounce(const float _delayTime, const float _scrollTime,
|
|
|
|
const float _currentTime, const float _scrollLength);
|
|
|
|
float loop(const float _delayTime, const float _scrollTime,
|
|
|
|
const float _currentTime, const float _scrollLength);
|
|
|
|
}
|
|
|
|
}
|
2017-11-06 10:46:15 +00:00
|
|
|
|
|
|
|
#endif // ES_CORE_MATH_MISC_H
|