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

Function cstrPolynomials

python/src/Construct/Polynomials.cpp:16–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15namespace py = pybind11;
16void cstrPolynomials(py::module_&m)
17{
18 py::class_<LNLib::Polynomials>(m, "Polynomials")
19 .def_static("Horner", py::overload_cast<int, const std::vector<double>&, double>(&LNLib::Polynomials::Horner))
20 .def_static("Horner", [](int degreeU, int degreeV, const std::vector<std::vector<double>>& coefficients, LNLib::UV uv) {
21 return LNLib::Polynomials::Horner(degreeU, degreeV, coefficients, uv);
22 })
23 .def_static("Bernstein", &LNLib::Polynomials::Bernstein)
24 .def_static("AllBernstein", &LNLib::Polynomials::AllBernstein)
25 .def_static("GetKnotMultiplicity", &LNLib::Polynomials::GetKnotMultiplicity)
26 .def_static("GetKnotSpanIndex", &LNLib::Polynomials::GetKnotSpanIndex)
27 .def_static("BasisFunctions", [](int spanIndex, int degree, const std::vector<double>& knotVector, double paramT) {
28 std::vector<double> basis(LNLib::Constants::NURBSMaxDegree + 1);
29 LNLib::Polynomials::BasisFunctions(spanIndex, degree, knotVector, paramT, basis.data());
30 return basis;
31 })
32 .def_static("BasisFunctionsDerivatives", &LNLib::Polynomials::BasisFunctionsDerivatives)
33 .def_static("BasisFunctionsFirstOrderDerivative", [](int spanIndex, int degree, const std::vector<double>& knotVector, double paramT) {
34 double derivatives[2][LNLib::Constants::NURBSMaxDegree + 1];
35 LNLib::Polynomials::BasisFunctionsFirstOrderDerivative(spanIndex, degree, knotVector, paramT, derivatives);
36 return std::vector<std::vector<double>>{
37 std::vector<double>(derivatives[0], derivatives[0] + LNLib::Constants::NURBSMaxDegree + 1),
38 std::vector<double>(derivatives[1], derivatives[1] + LNLib::Constants::NURBSMaxDegree + 1)
39 };
40 })
41 .def_static("OneBasisFunction", &LNLib::Polynomials::OneBasisFunction)
42 .def_static("OneBasisFunctionDerivative", &LNLib::Polynomials::OneBasisFunctionDerivative)
43 .def_static("AllBasisFunctions", &LNLib::Polynomials::AllBasisFunctions)
44 .def_static("BezierToPowerMatrix", &LNLib::Polynomials::BezierToPowerMatrix)
45 .def_static("PowerToBezierMatrix", &LNLib::Polynomials::PowerToBezierMatrix);
46}

Callers 1

constructFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected