Skip to content

Commit

Permalink
Added invSmoothStep.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Dec 20, 2020
1 parent 7837d90 commit 279b8ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/bx/inline/math.inl
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ namespace bx
return square(_a)*(3.0f - 2.0f*_a);
}

inline BX_CONST_FUNC float invSmoothStep(float _a)
{
return 0.5f - sin(asin(1.0f - 2.0f * _a) / 3.0f);
}

inline BX_CONSTEXPR_FUNC float bias(float _time, float _bias)
{
return _time / ( ( (1.0f/_bias - 2.0f)*(1.0f - _time) ) + 1.0f);
Expand Down
3 changes: 3 additions & 0 deletions include/bx/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ namespace bx
///
BX_CONSTEXPR_FUNC float smoothStep(float _a);

///
BX_CONST_FUNC float invSmoothStep(float _a);

///
BX_CONSTEXPR_FUNC float bias(float _time, float _bias);

Expand Down

0 comments on commit 279b8ff

Please sign in to comment.