Skip to content

Instantly share code, notes, and snippets.

@Gerjo
Created August 19, 2013 17:23
Show Gist options
  • Save Gerjo/6271684 to your computer and use it in GitHub Desktop.
Save Gerjo/6271684 to your computer and use it in GitHub Desktop.
Bernstein basis polynomial
///
///
///
///
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