4#include "MRPch/MRBindingMacros.h"
5#include <MRPch/MREigenCore.h>
19 return 1 <= degree && degree <= 4;
30template <
typename T,
size_t degree>
33 static constexpr size_t n = degree + 1;
36 MR_BIND_IGNORE Eigen::Vector<T, n>
a;
38 template <
typename NewT>
53template <
size_t degree>
56template <
size_t degree>
77 template <
size_t degree>
93template <
typename T,
size_t degree>
108 static constexpr size_t n = degree + 1;
110 Eigen::Matrix<T, n, n> XtX_;
111 Eigen::Vector<T, n> XtY_;
115template <
size_t degree>
118template <
size_t degree>
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Definition MRBestFitPolynomial.h:95
MRMESH_API void addPoint(T x, T y)
MRMESH_API BestFitPolynomial(T reg)
MRMESH_API void addPoint(T x, T y, T weight)
MRMESH_API Polynomial< T, degree > getBestPolynomial() const
Definition MRCameraOrientationPlugin.h:8
constexpr bool canMinimizePolynomial(auto degree)
Definition MRBestFitPolynomial.h:22
constexpr bool canSolvePolynomial(auto degree)
Definition MRBestFitPolynomial.h:17
std::variant< Polynomial< T, 0 >, Polynomial< T, 1 >, Polynomial< T, 2 >, Polynomial< T, 3 >, Polynomial< T, 4 >, Polynomial< T, 5 >, Polynomial< T, 6 > > Polynomialx
Definition MRBestFitPolynomial.h:61
This is a unifying interface for a polynomial of some degree, known only in runtime.
Definition MRBestFitPolynomial.h:74
PolynomialWrapper(const Polynomial< T, degree > &p)
Definition MRBestFitPolynomial.h:78
MRMESH_API PolynomialWrapper< T > deriv() const
Polynomialx< T > poly
Definition MRBestFitPolynomial.h:75
MRMESH_API std::optional< T > intervalMin(T a, T b) const
MRMESH_API T operator()(T x) const
Definition MRBestFitPolynomial.h:32
MR_BIND_IGNORE Eigen::Vector< T, n > a
Definition MRBestFitPolynomial.h:36
static constexpr size_t n
Definition MRBestFitPolynomial.h:33
MRMESH_API T intervalMin(T a, T b) const
MRMESH_API T operator()(T x) const
Polynomial< NewT, degree > cast() const
Definition MRBestFitPolynomial.h:39
MRMESH_API Polynomial< T, degree==0 ? 0 :degree - 1 > deriv() const
MRMESH_API std::vector< T > solve(T tol) const