HighMap library (C++)
Loading...
Searching...
No Matches
interpolate1d.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 Public License. The full license is in the file LICENSE, distributed with
3 this software. */
4
18#pragma once
19#include <map>
20#include <vector>
21
22#include <gsl/gsl_interp.h>
23#include <gsl/gsl_spline.h>
24
25namespace hmap
26{
27
45
65{
66public:
89 Interpolator1D(const std::vector<float> &x,
90 const std::vector<float> &y,
92
99
110 float operator()(float x) const;
111
121 float interpolate(float x) const;
122
123private:
124 gsl_spline *interp;
125 gsl_interp_accel *accel_;
126 std::vector<double> x_data;
127 std::vector<double> y_data;
128 double xmin;
129 double xmax;
130};
131
132} // namespace hmap
A class for performing 1D interpolation using the GSL library.
Definition interpolate1d.hpp:65
float interpolate(float x) const
Interpolates the value at the specified x coordinate.
Definition interpolate1d.cpp:155
float operator()(float x) const
Function call operator for performing interpolation.
Definition interpolate1d.cpp:150
~Interpolator1D()
Destructor for Interpolator1D.
Definition interpolate1d.cpp:144
Definition algebra.hpp:23
InterpolationMethod1D
Enumeration of the available 1D interpolation methods.
Definition interpolate1d.hpp:36
@ CUBIC
Cubic spline interpolation.
Definition interpolate1d.hpp:39
@ LINEAR
Linear interpolation.
Definition interpolate1d.hpp:41
@ POLYNOMIAL
Polynomial interpolation.
Definition interpolate1d.hpp:42
@ AKIMA
Akima interpolation.
Definition interpolate1d.hpp:37
@ CUBIC_PERIODIC
Cubic spline periodic interpolation.
Definition interpolate1d.hpp:40
@ STEFFEN
Steffen interpolation (monotonic)
Definition interpolate1d.hpp:43
@ AKIMA_PERIODIC
Akima periodic interpolation.
Definition interpolate1d.hpp:38