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
  • 1
    A linear scaling? Commented Dec 17, 2013 at 6:33
  • 1
    This question appears to be off-topic because it is a "name that thing" question. "Name that thing" are bad questions for the same reasons that "identify this obscure TV show, film or book by its characters or story" are bad questions: you can't Google them, they aren't practical in any way, they don't help anyone else, and allowing them opens the door for the asking of other types of marginal questions. See blog.stackoverflow.com/2012/02/lets-play-the-guessing-game
    – gnat
    Commented Dec 17, 2013 at 7:50
  • @gnat Thanks for the information. Do you suggest that I edit the title or question to make it more helpful to others? Or that I delete the question?
    – wip
    Commented Dec 17, 2013 at 8:27
  • 1
    @wil this is currently being discussed in Software Engineering Chat - chat.stackexchange.com/transcript/message/12695169#12695169
    – gnat
    Commented Dec 17, 2013 at 14:54

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 you have read our privacy policy.

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