Kstars

polynomialfit.h
1/*
2 SPDX-FileCopyrightText: 2019 Hy Murveit <hy-1@murveit.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QVector>
10#include <qcustomplot.h>
11
12namespace Ekos
13{
14
15class PolynomialFit
16{
17public:
18 // Constructor. Pass in the degree of the desired polynomial fit, and a vector with the x and y values.
19 // The constructor solves for the polynomial coefficients.
20 PolynomialFit(int degree, uint8_t maxCount, const QVector<double>& x, const QVector<double>& y);
21 PolynomialFit(int degree, const QVector<int>& x, const QVector<double>& y);
22
23 // Returns the minimum position and value in the pointers for the solved polynomial.
24 // Returns false if the polynomial couldn't be solved.
25 bool findMinimum(double expected, double minPosition, double maxPosition, double *position, double *value);
26
27 /**
28 * @brief Polynomial function f(x)
29 * @param x argument
30 * @return f(x)
31 */
32 double f(double x);
33
34
35private:
36 // Solves for the polynomial coefficients.
37 void solve(const QVector<double>& positions, const QVector<double>& values);
38
39 // Calculates the value of the polynomial at x.
40 // Params will be cast to a PolynomialFit*.
41 static double polynomialFunction(double x, void *params);
42
43 // Polynomial degree.
44 int degree;
45 // The data values.
46 QVector<double> x, y;
47 // The solved polynomial coefficients.
48 std::vector<double> coefficients;
49};
50}
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:83
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.