added clamp()

This commit is contained in:
Ahmet Inan 2021-05-07 17:43:17 +02:00
commit 5c456aae28

View file

@ -22,6 +22,12 @@ AB lerp(AB a, AB b, X x)
return (X(1) - x) * a + x * b;
}
template <typename TYPE>
TYPE clamp(TYPE x, TYPE a, TYPE b)
{
return x < a ? a : x > b ? b : x;
}
template <typename TYPE>
TYPE normal_pdf(TYPE x, TYPE m, TYPE s)
{