Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # re-maps a number that is within one range, to be within another range
- # example remap 0-255 to be 0-1: remap(23,0,255,0,1)
- function remap(val,valmin,valmax,newmin,newmax)
- return ((val - valmin) / (valmax - valmin)) * (newmax - newmin) + newmin
- end-function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement