Last active
April 19, 2019 14:01
-
-
Save taikomatsu/4810eea45ab23be14af2b548f20a5588 to your computer and use it in GitHub Desktop.
bias & gain for VEX short ver
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
float bias(float b; float x) { | |
return pow(x, log(b)/log(0.5)); | |
} | |
float gain(float g; float x) { | |
return (x<0.5) ? bias(1-g, 2*x)*.5 : 1-bias(1-g, 2-2*x)*.5; | |
} | |
// usage example | |
float x = v@P.x; | |
//v@P.y = bias(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