Created
August 19, 2013 17:23
-
-
Save Gerjo/6271684 to your computer and use it in GitHub Desktop.
Bernstein basis polynomial
This file contains hidden or 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 BernsteinBasis(const int d, const int n, float x) { | |
// Binomial coefficient: | |
const int b = Factorial(d) / (Factorial(d - n) * Factorial(n)); | |
// Bernstein polynomial: | |
return b * powf(x, n) * powf(1 - x, d - n); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment