Lesley's Digital Garden

Home

❯

Notes

❯

remap from an input range to an output range

remap from an input range to an output range

Mar 14, 2024

  • parent : lerp
  • math/interpolation/lerp

remap is a useful function that takes a value from an input range to an output range. Its implementation combines an inverse lerp and a lerp.

float remap(float i_min, float i_max, float o_min, float o_max, float v) {
  float t = inverse_lerp(i_min, i_max, v);
  return lerp(o_min, o_max, t);
}

References

  • Inverse Lerp - a super useful yet often overlooked function

Graph View

Backlinks

  • inverse lerp
  • lerp

Created with Quartz v4.5.2 © 2026. All notes are written in Obsidian.

  • GitHub Repository
  • Mastodon