Compare commits
No commits in common. "880bbba4914f3675b92d3c9bf36123360e8a39ce" and "7ed67fcd41a13452d8ef14de4c3a42094d8cef37" have entirely different histories.
880bbba491
...
7ed67fcd41
2 changed files with 1 additions and 23 deletions
|
|
@ -287,9 +287,7 @@ namespace psemek::math
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T clamp(T x, interval<T> const & i)
|
T clamp(T x, interval<T> const & i)
|
||||||
{
|
{
|
||||||
using std::min;
|
return std::max(i.min, std::min(i.max, x));
|
||||||
using std::max;
|
|
||||||
return max(i.min, min(i.max, x));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
||||||
|
|
@ -183,14 +183,6 @@ namespace psemek::math
|
||||||
return (x >= 0) ? std::fmod(x, m) : (m - std::fmod(-x, m));
|
return (x >= 0) ? std::fmod(x, m) : (m - std::fmod(-x, m));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
auto clamp(T const & x, T const & low, T const & high)
|
|
||||||
{
|
|
||||||
using std::min;
|
|
||||||
using std::max;
|
|
||||||
return min(high, max(low, x));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool make_min(T & target, T const & source)
|
bool make_min(T & target, T const & source)
|
||||||
{
|
{
|
||||||
|
|
@ -230,12 +222,6 @@ namespace psemek::math
|
||||||
return x * x * (T{3} - T{2} * x);
|
return x * x * (T{3} - T{2} * x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
T smoothstep(T edge0, T edge1, T x)
|
|
||||||
{
|
|
||||||
return smoothstep(clamp((x - edge0) / (edge1 - edge0), T{0}, T{1}));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T smootherstep(T x)
|
T smootherstep(T x)
|
||||||
{
|
{
|
||||||
|
|
@ -243,12 +229,6 @@ namespace psemek::math
|
||||||
return x * x2 * (T{10} - x * T{15} + x2 * T{6});
|
return x * x2 * (T{10} - x * T{15} + x2 * T{6});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
T smootherstep(T edge0, T edge1, T x)
|
|
||||||
{
|
|
||||||
return smootherstep(clamp((x - edge0) / (edge1 - edge0), T{0}, T{1}));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T inverse_smoothstep(T x)
|
T inverse_smoothstep(T x)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue