ACF $AcfVersion:0$
CLinearInterpolator.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QMap>
7
8// ACF includes
10
11
12namespace imath
13{
14
15
77{
78public:
80
84 CLinearInterpolator(double* positions, double* values, int nodesCount, bool isExtrapolationEnabled = false);
85
86 void SetNodes(double* positions, double* values, int nodesCount);
87
88 // reimplemented (imath::ISampledFunctionInterpolator)
89 virtual bool InitFromFunction(const ISampledFunction& function) override;
90
91 // reimplemented (imath::TIMathFunction<double, double>)
92 virtual bool GetValueAt(const double& argument, double& result) const override;
93 virtual double GetValueAt(const double& argument) const override;
94
95private:
96 typedef QMap<double, double> Nodes;
97 Nodes m_nodes;
98 bool m_isExtrapolationEnabled;
99};
100
101
102} // namespace imath
103
104
Implementation of a linear interpolator for piecewise linear function approximation.
void SetNodes(double *positions, double *values, int nodesCount)
virtual bool GetValueAt(const double &argument, double &result) const override
CLinearInterpolator(double *positions, double *values, int nodesCount, bool isExtrapolationEnabled=false)
virtual bool InitFromFunction(const ISampledFunction &function) override
Initialize interpolator based on a sample function.
virtual double GetValueAt(const double &argument) const override
Interface for a 1D-interpolator based on a sampled function.
Package with mathematical functions and algebraical primitives.