I'm having this problem on some game I'm coding which I think it's just math and has nothing to do with coding, that's why I'm posting it here and I'm going to simplify the problem without describing anything related to the actual code. In case you want to take a look, please see this question on Stack Overflow: http://stackoverflow.com/questions/5822740/how-to-correctly-get-the-terrain-height-at-point-x-z-in-a-scaled-terrain
Let's say I want to draw a line on screen, with width w. To draw this line I need to do it in steps, sw, by default 1 unit steps. But I do allow this width to be scaled to any other value. After selecting the new width, dw, the new step needs to be calculated and I do it like this: sw = dw / w. With this, the line is properly scaled and I can draw it just fine.
Now, for a given x of that line I need to do some other calculations. Since I allowed the line to be scaled and it's not the original width. I need to calculate the real x, nx, before anything else. I just need to work on the step value calculated before, like this: nx = x / sw.
This will give me exactly the right nx value I'm looking for. Everything's working so far.
Now, my real problem is when I need to introduce a little change to the step calculation. Instead of calculating the step like I said before (sw = dw / w) I need to calculate it like this: sw = dw / (w - 1).
The problem I'm actually having is in the next step. Given x, how do I correctly calculate nx as I did before? Math is not my strong suite and I tried many things that I would think were right but it was mostly trial and error. Suffice to say, nothing worked.

wandsw, let's say 100 and 1. This will draw a line from 0 to 100 in steps of 1 (think of it as points in the line). If I want to scale the line to 150,swwill become 1.5. I still draw the line with points from 0 to 100 but now in steps of 1.5, which will make the line end at 150 and not 100 as before. For a givenx, for instance, 10. What'snx? Without scaling,x=10 => nx=10,x=100 => nx=100. With scaling,x=10 => nx=6.66,x=150 => nx=100. This is what I want. – Ricardo Amaral Apr 28 '11 at 20:28