mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-19 19:35:26 +00:00
inverse lerp function
This commit is contained in:
parent
0d981b62cf
commit
c5afb407db
2 changed files with 19 additions and 0 deletions
|
|
@ -265,6 +265,14 @@ inline T mLerp( const T &v1, const T &v2, F32 factor )
|
|||
return ( v1 * ( 1.0f - factor ) ) + ( v2 * factor );
|
||||
}
|
||||
|
||||
/// Template function for determining a percentage of interpolation between any two
|
||||
/// types which implement operators for scalar multiply and addition.
|
||||
template <typename T>
|
||||
inline T mInvLerp(const T& v1, const T& v2, F32 point)
|
||||
{
|
||||
return (point - v1) / (v2 - v1);
|
||||
}
|
||||
|
||||
inline S32 mMulDiv(S32 a, S32 b, S32 c)
|
||||
{
|
||||
return m_mulDivS32(a, b, c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue