the height calculation use the closest pts at each corner(NE, NW, SE, SW), this works for a grid orientated north-south but not for some grids at some angle.

In this picture there should be one more pts far east, little north. Not the point far North-West.
Probable solution: simply use the four closest points and try to figure out how to find out which pair to use to make each line?