Back to the original question...
You can get rid of one of the divides if you can "predivide" some values.
Here is your lerp after I simplified all the variables and removed the intermediate computations:
p->scale = Sw + (L - Sx)/(Nx - Sx)( Nw - Sw )
This is the same as:
p->scale = Sw/(Nx - Sx)(Nx - Sx) + (L - Sx)( Nw - Sw )/(Nx - Sx)
which is the same as
p->scale = Skk + (L - Sx)( Nk - Sk )
where k, Nk, and Sk are precomputed like this:
k = Nx - Sx Nk = Nw / k Sk =Sw / k
I have no idea if you can precompute these values, but if you can it will save one divide.
Edit: fixed a typo
[Edited by - JohnBolton on May 23, 2007 12:18:19 PM]
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!