2

I have a function that linearly "remaps" a value from a given interval to an other interval?

The function remaps a value from a given interval [oldMin, oldMax] to another interval [newMin, newMax] using this formula:

newVal = newMin + (newMax - newMin) * (oldVal - oldMin) / (oldMax - oldMin)

If it helps identify what type of transform it is, the above formula is just a reformulation of the following equation. All I did was re-arrange the terms to express newVal on the left hand side of the equation so it is a function of all the other parameters:

enter image description here

Is there a standard name for the remapping transformation?

4

2 Answers 2

9

This is known as Linear Interpolation.

Very common and powerful, in game development it's shorthand is "Lerp"

It is used to map one value (in a range) to another value (in a range). For example one might map health to color (for tinting the health bar) or time to rotation (for animation).

8

Mathematically, it's an affine transformation -- a linear transformation composed with a translation (from oldMin to newMin).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.