yarn icon indicating copy to clipboard operation
yarn copied to clipboard

MathHelper.lerpFromProgress -> map

Open Juuxel opened this issue 2 years ago • 2 comments

and clampedLerpFromProgress -> clampedMap.

These functions take five values lerpValue, lerpStart, lerpEnd, start, end and map the lerpValue from the first range (lerpStart..lerpEnd) to the second (start..end). Additionally, clampedLerpFromProgress clamps it to the new range.

lerpFromProgress is a very confusing name for this method and doesn't really describe what it does. Processing has an equivalent method, which they call map, and I think that is much more descriptive. In any case, we should document the method to clarify it.

Juuxel avatar Jul 19 '21 11:07 Juuxel

Also, MathHelper.getLerpProgress(value, from, to) can be considered normalising a number from a range from..to to 0..1. (Processing calls this norm for that reason.)

Though I'm not sure whether renaming it is that useful since you can also think of it as the lerp delta between from and to.

Juuxel avatar Jul 19 '21 15:07 Juuxel

I support this rename. "lerp from progress" is really confusing, and I have to look up the method to see in what order the parameters are each time. map sounds a lot simpler.

mschae23 avatar Jul 30 '21 07:07 mschae23