You guys ever end up using std::lerp and wishing there was an inverse/unlerp() function?
I cant imagine why they would standardize lerp but not unlerp. I find that 90% of my uses of one involve the other (i.e to remap a range, usually colors or noise values or something like that).
(of course its trivial to hand roll, but its just a bit awkward using my_own::unlerp() alongside std::lerp())
I haven't needed unlerp ((x - a) / (b - a)), because generally my range minimum is 0 when normalizing (reducing that to just x / b), but I see how it could be useful, and evidently it exists in Unity and Construct.
View all comments
Show parent comment
1
u/Dubbus_ May 08 '26
You guys ever end up using std::lerp and wishing there was an inverse/unlerp() function?
I cant imagine why they would standardize lerp but not unlerp. I find that 90% of my uses of one involve the other (i.e to remap a range, usually colors or noise values or something like that).
(of course its trivial to hand roll, but its just a bit awkward using my_own::unlerp() alongside std::lerp())