public override double Execute(double x, double y, double z, CallableNode flow) { var ix = (x - fromX) * voxel2PixelPosX; var iz = (z - fromZ) * voxel2PixelPosZ; var hx = Mathf.Clamp((int)ix, 0, width - 1); var hz = Mathf.Clamp((int)iz, 0, height - 1); if (hx < 0 || hz < 0 || hx >= width - 1 || hz >= height - 1) { return(0); } var h00 = heights[hx + width * hz]; var h01 = heights[hx + width * (hz + 1)]; var h10 = heights[(hx + 1) + width * hz]; var h11 = heights[(hx + 1) + width * (hz + 1)]; return(UMath.BilinearInterpolate(h00, h01, h10, h11, ix - hx, iz - hz)); }