logo separator

[mkgmap-dev] HGT - getElevation()

From Gerd Petermann gpetermann_muenchen at hotmail.com on Tue Jan 9 15:41:59 GMT 2018

Andrzej, Frank,

I found class InterpolationBilinear
http://download.java.net/media/jai/javadoc/1.1.3/jai-apidocs/javax/media/jai/InterpolationBilinear.html
which seems to do exactly what you propose when all four values are valid.

I found no code for triangular interpolation yet, but I assume we can use the existing code in interpolatedHeightInNormatedRectangle with some more math.
We just have to "rotate" the values and xchange qx and qy so that interpolatedHeightInNormatedRectangle never returns UNDEF if three values are valid.
Right?

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <popej at poczta.onet.pl>
Gesendet: Dienstag, 9. Januar 2018 15:45:14
An: mkgmap-dev at lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] HGT - getElevation()

Hi Gerd,

I'm trying to find if resolution can be better. I think current
interpolation is not good. Imagine two combination of 4-points heights
from HGT with values like:

1 0
0 7

and

0 1
7 0

For a point in the middle of rectangle, current interpolation would give
result 0 in first case and 4 in second, while I would expect 2 in both
cases.

I think the code, which calculates interpolation based on 3 points,
should be used only if the forth is void. There could be 3 combinations
of triangles in this case. But if all 4 points are valid, there should
be applied standard bilinear interpolation. Something like:

if (hlb == HGTReader.UNDEF) {
        return triangle(...
}
if (hrb == HGTReader.UNDEF) {
        return triangle(...
}
if (hlt == HGTReader.UNDEF) {
        return triangle(...
}
if (hrt == HGTReader.UNDEF) {
        return triangle(...
}

// 4 points valid
return bilinear(...


--
Best regards,
Andrzej

_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


More information about the mkgmap-dev mailing list