Add 3-argument smoothstep and smootherstep
All checks were successful
Run tests / Run tests (push) Successful in 8m42s
All checks were successful
Run tests / Run tests (push) Successful in 8m42s
This commit is contained in:
parent
2db6c32310
commit
880bbba491
1 changed files with 12 additions and 0 deletions
|
|
@ -230,6 +230,12 @@ namespace psemek::math
|
|||
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>
|
||||
T smootherstep(T x)
|
||||
{
|
||||
|
|
@ -237,6 +243,12 @@ namespace psemek::math
|
|||
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>
|
||||
T inverse_smoothstep(T x)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue