Terrainpage bug

i wanted to get the height of my terrain at x -0.00006 and z -0.00006 (0/0 is the center)

i got NaN because this condition:

col >= size - 1
was true. (terrainblock:285)
i found a rather suspicious "If (x == 0) x -= 0.1F"-fix which seems to try to hide the bug, but it didn't excpect someone to try to get the height really close to zero.
should "If (x>-0.1F) x=0.1F" fix it?

I have been looking at this problem, and I don't quite understand the problem…



When you define a TerrainBlock, you have a matrix of heights associated with a grid at integer values, right? And that matrix covers the square from (0,0) to (size-1,size-1) both inclusive. That means that the if statement is there for your protection… if you access anything outside that range, then you get an elegant NaN out of the height. In particular, you can only ask for the heights with x and y coordinates x,y >= 0 and x,y <= size-1.



If you want to increment the bounds of your block, that is OK, I guess, but IMHO it will always be better to change the structure of the code so that you don't need to face this problem at all.