Hi, I want to write a program that generates a map. The map should be represented as colors, the colors being the height(z-axis) of that point in the map. The way I store the data is by using a 2-dimensional integer array and setting each (x,y,z) point in the map as map[x][y]=z and when i want to draw the map, I iterate through the array and paint each point according to its z value. Is there a better way to store the data and to draw the map?
----------------------------------<br />SCJP 1.4
posted 12 years ago
hi the two-dimensional array aproach is actually the same as a bitmap (bmp) image. (eg. an colour bitmap with 16.7 m. colours is a 3 dimensional array of 8 bit values: (2^8)^3 = 16.7m ) so you could probably apply a "non lossy reduction" algorithm such as gif or png to your data (gif only works for 256 colours, i think png is better. so much about the theory...i dont have a clue how to do this... maybe this can give you some new ideas... k