|
CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
|
#include <spatial_interpolation.h>
Public Member Functions | |
| SpatialInterpolator (std::vector< Point2D > const &points, std::vector< double > const &values, int k_neighbors=12, double power=2.0) | |
| ~SpatialInterpolator () | |
| double | Interpolate (double x, double y) const |
| void | Interpolate (std::vector< Point2D > const &query_points, std::vector< double > &results) const |
| KDTree const * | GetKDTree () const |
| PointCloud const & | GetPointCloud () const |
Private Member Functions | |
| SpatialInterpolator (PointCloud const &cloud, KDTree *kdtree, std::vector< double > const &values, int k_neighbors, double power) | |
Private Attributes | |
| PointCloud | m_cloud |
| std::vector< double > | m_values |
| KDTree * | m_kdtree |
| int | m_k_neighbors |
| double | m_power |
| bool | m_owns_kdtree |
Static Private Attributes | |
| static constexpr double | EPSILON = 1e-10 |
Friends | |
| class | DualSpatialInterpolator |
Definition at line 86 of file spatial_interpolation.h.
| SpatialInterpolator::SpatialInterpolator | ( | std::vector< Point2D > const & | points, |
| std::vector< double > const & | values, | ||
| int | k_neighbors = 12, | ||
| double | power = 2.0 ) |
Spatial Interpolation Using k-Nearest Neighbors and Inverse Distance Weighting
This file implements fast spatial interpolation using:
For each query point (grid cell):
std::vector<Point2D> input_points = {{0,0}, {10,0}, {5,10}}; std::vector<double> input_values = {1.0, 2.0, 1.5}; SpatialInterpolator interp(input_points, input_values, 12, 2.0); double result = interp.Interpolate(5.0, 5.0); // Interpolate at (5,5) Constructor: Build interpolator from points and values
| points | Input point coordinates (x, y) |
| values | Values at those points |
| k_neighbors | Number of nearest neighbors to use (default: 12) |
| power | IDW power parameter (default: 2.0) |
Definition at line 59 of file spatial_interpolation.cpp.
| SpatialInterpolator::~SpatialInterpolator | ( | ) |
Definition at line 89 of file spatial_interpolation.cpp.
|
private |
Definition at line 80 of file spatial_interpolation.cpp.
|
inline |
Definition at line 104 of file spatial_interpolation.h.
|
inline |
Definition at line 107 of file spatial_interpolation.h.
| double SpatialInterpolator::Interpolate | ( | double | x, |
| double | y ) const |
Interpolate at a single query point
ALGORITHM:
SPECIAL CASES:
| x | X coordinate of query point |
| y | Y coordinate of query point |
Definition at line 111 of file spatial_interpolation.cpp.
Referenced by Interpolate().
| void SpatialInterpolator::Interpolate | ( | std::vector< Point2D > const & | query_points, |
| std::vector< double > & | results ) const |
Definition at line 167 of file spatial_interpolation.cpp.
|
friend |
Definition at line 120 of file spatial_interpolation.h.
Referenced by DualSpatialInterpolator.
|
staticconstexprprivate |
Definition at line 117 of file spatial_interpolation.h.
Referenced by Interpolate(), and Interpolate().
|
private |
Definition at line 110 of file spatial_interpolation.h.
Referenced by GetPointCloud(), Interpolate(), Interpolate(), SpatialInterpolator(), and SpatialInterpolator().
|
private |
Definition at line 113 of file spatial_interpolation.h.
Referenced by Interpolate(), Interpolate(), SpatialInterpolator(), and SpatialInterpolator().
|
private |
Definition at line 112 of file spatial_interpolation.h.
Referenced by GetKDTree(), Interpolate(), Interpolate(), SpatialInterpolator(), SpatialInterpolator(), and ~SpatialInterpolator().
|
private |
Definition at line 115 of file spatial_interpolation.h.
Referenced by SpatialInterpolator(), SpatialInterpolator(), and ~SpatialInterpolator().
|
private |
Definition at line 114 of file spatial_interpolation.h.
Referenced by Interpolate(), Interpolate(), SpatialInterpolator(), and SpatialInterpolator().
|
private |
Definition at line 111 of file spatial_interpolation.h.
Referenced by Interpolate(), Interpolate(), SpatialInterpolator(), and SpatialInterpolator().