46static std::map<InterpolationMethod2D, std::string>
47 interpolation_method_2d_as_string = {{
DELAUNAY,
"Delaunay linear"},
73 float a10 = f10 - f00;
74 float a01 = f01 - f00;
75 float a11 = f11 - f10 - f01 + f00;
76 return f00 + a10 * u + a01 * v + a11 * u * v;
81 return p[1] + 0.5 * x *
83 x * (2.0 * p[0] - 5.0 * p[1] + 4.0 * p[2] - p[3] +
84 x * (3.0 * (p[1] - p[2]) + p[3] - p[0])));
111 const std::vector<float> &x,
112 const std::vector<float> &y,
113 const std::vector<float> &values,
115 const Array *p_noise_x =
nullptr,
116 const Array *p_noise_y =
nullptr,
117 const Array *p_stretching =
nullptr,
118 Vec4<float> bbox = {0.f, 1.f, 0.f, 1.f});
140 const std::vector<float> &x,
141 const std::vector<float> &y,
142 const std::vector<float> &values,
143 const Array *p_noise_x =
nullptr,
144 const Array *p_noise_y =
nullptr,
145 const Array *p_stretching =
nullptr,
146 Vec4<float> bbox = {0.f, 1.f, 0.f, 1.f});
169 const std::vector<float> &x,
170 const std::vector<float> &y,
171 const std::vector<float> &values,
172 const Array *p_noise_x =
nullptr,
173 const Array *p_noise_y =
nullptr,
174 const Array *p_stretching =
nullptr,
175 Vec4<float> bbox = {0.f, 1.f, 0.f, 1.f});
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Definition algebra.hpp:28
InterpolationMethod2D
Enumeration of 2D interpolation methods.
Definition interpolate2d.hpp:34
@ DELAUNAY
Delaunay triangulation method for 2D interpolation.
Definition interpolate2d.hpp:35
@ NEAREST
Nearest point method for 2D interpolation.
Definition interpolate2d.hpp:36
Array interpolate2d_nearest(Vec2< int > shape, const std::vector< float > &x, const std::vector< float > &y, const std::vector< float > &values, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f})
2D interpolation using the nearest neighbor method.
Definition interpolate2d.cpp:51
Array interpolate2d(Vec2< int > shape, const std::vector< float > &x, const std::vector< float > &y, const std::vector< float > &values, InterpolationMethod2D interpolation_method, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f})
Generic 2D interpolation function.
Definition interpolate2d.cpp:16
Array interpolate2d_delaunay(Vec2< int > shape, const std::vector< float > &x, const std::vector< float > &y, const std::vector< float > &values, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f})
2D interpolation using the Delaunay triangulation method.
Definition interpolate2d.cpp:90
float bilinear_interp(float f00, float f10, float f01, float f11, float u, float v)
Compute the bilinear interpolated value from four input values.
Definition interpolate2d.hpp:66
float cubic_interpolate(float p[4], float x)
Definition interpolate2d.hpp:79