limp is a made up abbreviation for linear interval map, which linearly maps:

  • a scalar value x0, that's in a
  • scalar interval u0: [min: number, max: number] to
  • a scalar output return value x1, that's in the
  • scalar interval u1: [min: number, max: number]

the math equation is simply x1 = u1[0] + (x - u0[0]) * (u1[1] - u1[0]) / (u0[1] - u0[0]). which is basically doing inverse_lerp on x0 to find t, then applying lerp onto interval u1 with the found t.

you may think of this function as a means for finding the "y-coordinate" (x1) of a point at the "x-coordinate" x0, that is between two connected line segment points (u0[0], u1[0]) and (u0[1], u1[1]).