3 #ifndef GALAXIS_POLYFIT_H
4 #define GALAXIS_POLYFIT_H
19 std::shared_ptr<std::vector<double>> galaxis_polyfit(std::vector<double>& pointsX,
20 std::vector<double>& pointsY,
21 int p_amountOfRandomPointsForFitting,
22 int p_iterationAmount,
27 if(pointsX.size() < (p_degree + 1) || pointsX.size() != pointsY.size()) {
28 std::shared_ptr<std::vector<double>>
29 coeff = std::make_shared<std::vector<double>>();
38 if(pointsX.size() <= p_amountOfRandomPointsForFitting) {
39 if(!(((ssize_t)pointsX.size() - 2) > 1)) {
40 std::shared_ptr<std::vector<double>>
41 coeff = std::make_shared<std::vector<double>>();
49 p_amountOfRandomPointsForFitting = pointsX.size() - 2;
58 options.
maxMPts = p_amountOfRandomPointsForFitting;
59 options.
maxTrial = p_iterationAmount;
69 std::shared_ptr<std::vector<double>>
70 coeff = std::make_shared<std::vector<double>>();
74 if(polynomVecType.size() != (p_degree + 1)) {
75 std::shared_ptr<std::vector<double>>
76 coeff = std::make_shared<std::vector<double>>();
85 for(ssize_t i = p_degree; i >= 0; i--) {
86 coeff->push_back(polynomVecType(i, 0));
95 }
catch(std::exception& e) {
96 std::cout <<
"Exception in Polyfit" << std::endl;
97 std::shared_ptr<std::vector<double>> coeff = std::make_shared<std::vector<double>>();
107 std::shared_ptr<std::vector<double>> galaxis_polyfit(std::vector<galaxis::lina::Vector2f>
const& p_pointCloud,
108 int p_amountOfRandomPointsForFitting,
109 int p_iterationAmount,
111 bool p_switchxy =
false,
112 double p_pointsDivisionFactor = 1,
116 throw "[GALAXIS POLYFIT] Function deprecated. Update your Code!";
117 return std::make_shared<std::vector<double>>();