views:

288

answers:

1

Hi,

I'm looking for an easy way to render altitude data into a heightmap. It could be a little easier to be archived with other techniques than kriging, like triangulation, but in this case speed doesn't cost and kriging was the most realistic way.

Lets say I have the altitude points in an array and I want to call a function that calculates the approximate height of every point / pixel, like this (in C++):

double CalculateHeight(AltitudePoint* AltitudeData, int AltitudePointCount, int x, int y);
void SetPixel(int x, int y, double value); 

struct AltitudePoint
{
   float x;
   float y;
   float z;
};

AltitudePoint AltitudeData[10];

void CalculateHeightmap(int Width, int Height)
{
   for (int y = 0; y < Height, y++)
      for (int x = 0; x < Width, x++)
         SetPixel(x, y, CalculateHeight(&AltitudeData[0], 10, x, y));
}

C++ or C# answer (or CalculateHeight -style function) would be nice, but I don't think having too much problems with other languages either.

Thanks already.

+1  A: 

Have you seen the http://stackoverflow.com/questions/557496/heightmap-generation-algorithm question?

Igor Brejc