Fixed incorrect height calculation when interpolating between two non-diagnonal points.
This commit is contained in:
parent
eb4f8ac710
commit
958750f1ab
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Reference in a new issue