aboutsummaryrefslogtreecommitdiff
path: root/src/grids.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-05-12 22:01:25 +0200
committerEven Rouault <even.rouault@spatialys.com>2020-05-16 17:52:48 +0200
commitbe6b6d7ec9de452904aaf3a2e2758197065502fd (patch)
treec2c70496b80990e05881380c744f4304a7581837 /src/grids.cpp
parentc4059040012a9ab99831c2e0dec7b961fbf7cd5e (diff)
downloadPROJ-be6b6d7ec9de452904aaf3a2e2758197065502fd.tar.gz
PROJ-be6b6d7ec9de452904aaf3a2e2758197065502fd.zip
pj_bilinear_interpolation_three_samples(): add comments
Diffstat (limited to 'src/grids.cpp')
-rw-r--r--src/grids.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/grids.cpp b/src/grids.cpp
index a5d9da8e..3284bf02 100644
--- a/src/grids.cpp
+++ b/src/grids.cpp
@@ -3381,7 +3381,12 @@ bool pj_bilinear_interpolation_three_samples(
return false;
}
+ // From a input location lp, determine the grid cell into which it falls,
+ // by identifying the lower-left x,y of it (ix, iy), and the upper-right
+ // (ix2, iy2)
+
double grid_x = (lp.lam - extent.west) / extent.resX;
+ // Special case for grids with world extent, and dealing with wrap-around
if (lp.lam < extent.west) {
grid_x = (lp.lam + 2 * M_PI - extent.west) / extent.resX;
} else if (lp.lam > extent.east) {
@@ -3417,6 +3422,7 @@ bool pj_bilinear_interpolation_three_samples(
return false;
}
+ // Bilinear interpolation
double frct_lam = grid_x - ix;
double frct_phi = grid_y - iy;
double m10 = frct_lam;