MCPcopy Create free account
hub / github.com/BIMCoderLiang/LNLib / Horner

Method Horner

src/LNLib/Algorithm/Polynomials.cpp:22–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20using namespace LNLib;
21
22double Polynomials::Horner(int degree, const std::vector<double>& coefficients, double paramT)
23{
24 VALIDATE_ARGUMENT(degree > 0, "degree", "Degree must be greater than zero.");
25 VALIDATE_ARGUMENT(ValidationUtils::IsValidBezier(degree, coefficients.size()), "degree", "Coefficients size equal degree plus one.");
26 double result = coefficients[degree];
27 for (int i = degree - 1; i >= 0; i--)
28 {
29 result = result * paramT + coefficients[i];
30 }
31 return result;
32}
33
34double Polynomials::Bernstein(int index, int degree, double paramT)
35{

Callers

nothing calls this directly

Calls 2

GetUMethod · 0.45
GetVMethod · 0.45

Tested by

no test coverage detected