1
0
Fork 0

Fixed incorrect height calculation when interpolating between two non-diagnonal points.

This commit is contained in:
James.Hester 2019-01-11 09:06:09 +11:00
parent eb4f8ac710
commit 958750f1ab

View file

@ -729,10 +729,10 @@ double TGArray::altitude_from_grid( double lon, double lat ) const {
dx = xlocal - x1; dx = xlocal - x1;
dy = ylocal - y1; dy = ylocal - y1;
if (x1==x2) { if (x1==x2) {
elev = z1+dy*(z2-z1); elev = z1+dy*(z2-z1)/(y2-y1);
} }
else if (y1==y2) { else if (y1==y2) {
elev = z1+dx*(z2-z1); elev = z1+dx*(z2-z1)/(x2-x1);
} }
else { //diagonal: project onto 45 degree line else { //diagonal: project onto 45 degree line
int comp1 = x2-x1; int comp1 = x2-x1;