Last active
March 17, 2022 12:22
-
-
Save TheEyesightDim/4f38dd129f9c61bde93feed7af253be8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cmath> | |
#include <cstdio> | |
double smoothstep(double low, double high, double factor){ | |
auto k = std::fmin(1, std::fmax(0, (factor - low)/(high - low))); | |
return k*k*(3-2*k); | |
} | |
int main(){ | |
for(double i = 0.0; i < 1.0; i += .1){ | |
std::printf("%f\n", smoothstep(0.0, 1.0, i)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment