MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ create_polynomial_function()

Polynomial::DirectFunction MayaFlux::Nodes::Generator::Polynomial::create_polynomial_function ( const std::vector< double > &  coefficients)

Creates a polynomial function from coefficients.

Parameters
coefficientsVector of polynomial coefficients (highest power first)
Returns
Function that evaluates the polynomial

Generates a function that evaluates the polynomial defined by the specified coefficients. The cofficients are ordered from highest power to lowest.

Definition at line 199 of file Polynomial.cpp.

200{
201 return [coefficients](double x) {
202 double result = 0.0;
203 double x_power = 1.0;
204
205 for (double coefficient : std::ranges::reverse_view(coefficients)) {
206 result += coefficient * x_power;
207 x_power *= x;
208 }
209
210 return result;
211 };
212}