Skip to content

Instantly share code, notes, and snippets.

@taikomatsu taikomatsu/bias_gain.vfl
Last active Jan 22, 2019

Embed
What would you like to do?
bias & gain for VEX
float bias(float b; float x) {
return pow(x, log(b)/log(0.5));
}
float gain(float g; float x) {
if (x<0.5)
return bias(1-g, 2*x)/2;
else
return 1-bias(1-g, 2-2*x)/2;
}
// usage example
float x = v@P.x;
//v@P.y = bias(0.8, x);
//v@P.y = bias(0.2, x);
//v@P.y = gain(0.8, x);
v@P.y = gain(0.3 , x);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.