Nearest-neighbor interpolation in two dimensions. More...
#include <interp2_neigh.h>
This class performs nearest-neighbor interpolation when the data points are not arranged in a specified order (i.e. not on a grid). For a set of data , the value of
is predicted given a new value of x and y. Distances are determined with
The values and
are specified in x_scale and y_scale, respectively. If these values are negative (the default) then they are computed with
and
.
This class stores pointers to the data, not a copy. The data can be changed between interpolations without an additional call to set_data(), but the scales may need to be recomputed with compute_scale().
The vector type can be any type with a suitably defined operator
[].
Definition at line 74 of file interp2_neigh.h.
Public Types | |
typedef boost::numeric::ublas::vector< double > | ubvector |
typedef boost::numeric::ublas::vector< size_t > | ubvector_size_t |
Public Member Functions | |
void | compute_scale () |
Find scaling. | |
void | set_data (size_t n_points, vec_t &x, vec_t &y, vec_t &f) |
Initialize the data for the neigh interpolation. More... | |
double | eval (double x, double y) const |
Perform the interpolation. | |
double | operator() (double x, double y) const |
Perform the interpolation. | |
template<class vec2_t > | |
double | operator() (vec2_t &v) const |
Perform the planar interpolation using the first two elements of v as input. | |
void | eval_point (double x, double y, double &f, size_t &i1, double &x1, double &y1) const |
Interpolation returning the closest point. More... | |
Public Attributes | |
double | x_scale |
The user-specified x scale (default -1) | |
double | y_scale |
The user-specified y scale (default -1) | |
Protected Attributes | |
double | dx |
The scale in the x direction. | |
double | dy |
The scale in the y direction. | |
size_t | np |
The number of points. | |
vec_t * | ux |
The x-values. | |
vec_t * | uy |
The y-values. | |
vec_t * | uf |
The f-values. | |
bool | data_set |
True if the data has been specified. | |
|
inline |
This function interpolates x
and y
into the data returning f
. It also returns the closest x- and y-values found.
Definition at line 182 of file interp2_neigh.h.
|
inline |
This function will call the error handler if n_points
is zero.
Definition at line 138 of file interp2_neigh.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).