Last active
May 10, 2018 07:06
-
-
Save paniq/fd70eee87fd860148ed47855fc224017 to your computer and use it in GitHub Desktop.
Bernstein Polynomial Basis Coefficients as derived from mix()
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
// Bernstein Polynomial Basis Coefficients as derived from mix() | |
// x is in range 0..1 | |
void basis (float x) { | |
// basis 0 | |
float b00 = 1.0; | |
// basis 1 | |
float b10 = mix(b00, 0.0, x); | |
float b11 = mix(0.0, b00, x); | |
// basis 2 | |
float b20 = mix(b10, 0.0, x); | |
float b21 = mix(b11, b10, x); | |
float b22 = mix(0.0, b11, x); | |
// basis 3 | |
float b30 = mix(b20, 0.0, x); | |
float b31 = mix(b21, b20, x); | |
float b32 = mix(b22, b21, x); | |
float b33 = mix(0.0, b22, x); | |
// and so on | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment