I need to interpolate the 3" srtm data for a game I'm developing (it's like Minecraft - voxel style). I downloaded the srtm data from viewfinderpanoramas.org. My aim is to get the height for every meter, so I'm tiling the world into 16x16m chunks so I have to perform 256 interpolations per chunk. For every block in a chunk I'm doing the interpolations like that:
- Calculate lat/lon for the block my chunk with the help of this post
Calculate lat/lon for the 4 points q11 q12 q21 q22 which I need for my bilinear interpolation. You can see this calculation on the following picture. I'm add/sub 45m to each block's lat/lon because I want to find the nearest grid-point for each q11 q12 q21 q22 in my srtm-file. (the picture shows the calculation for the block in the top-left corner)
Then I'm searching the height data for q11 q12 q21 q22 in my srtm-file with the help of this post
- I'm performing my bilinear interpolation
The problem is, that my interpolated data looks like a heap of ruins but you can recognize the approximate terrain.
Can you tell me some hints or mistakes concerning my method?
Especially hints how I can get the 4 nearest grid points for the interpolation.