mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Added invLerp.
This commit is contained in:
@@ -127,6 +127,11 @@ namespace bx
|
||||
return _a + (_b - _a) * _t;
|
||||
}
|
||||
|
||||
inline BX_CONSTEXPR_FUNC float invLerp(float _a, float _b, float _value)
|
||||
{
|
||||
return (_value - _a) / (_b - _a);
|
||||
}
|
||||
|
||||
inline BX_CONSTEXPR_FUNC float sign(float _a)
|
||||
{
|
||||
return _a < 0.0f ? -1.0f : 1.0f;
|
||||
|
||||
@@ -146,6 +146,10 @@ namespace bx
|
||||
///
|
||||
BX_CONSTEXPR_FUNC float lerp(float _a, float _b, float _t);
|
||||
|
||||
/// Returns inverse linear interpolation of _value between two values _a and _b.
|
||||
///
|
||||
BX_CONSTEXPR_FUNC float invLerp(float _a, float _b, float _value);
|
||||
|
||||
/// Returns the sign of _a.
|
||||
///
|
||||
BX_CONSTEXPR_FUNC float sign(float _a);
|
||||
|
||||
Reference in New Issue
Block a user