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:
82 Interpolator1D(const std::vector<float> &x,
83 const std::vector<float> &y,
85
92
103 float operator()(float x) const;
104
114 float interpolate(float x) const;
115
116private:
117 gsl_spline *interp;
118 gsl_interp_accel *accel_;
119 std::vector<double> x_data;
120 std::vector<double> y_data;
121 double xmin;
122 double xmax;
123};
124
125} // 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:104
float operator()(float x) const
Function call operator for performing interpolation.
Definition interpolate1d.cpp:99
~Interpolator1D()
Destructor for Interpolator1D.
Definition interpolate1d.cpp:93
Definition algebra.hpp:28
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