rahji.com

ancient stuff

Mapping a value to a new range

A handy formula that I usually have to look for when I need it – make a value fall into a specific min-max range. This is the math that gives you a new, scaled up or down, value.

(x - original_min) * (new_max - new_min) /
(original_max - original_min) + new_min


Author rob duartePosted on October 11, 2010February 7, 2017Categories Electronics and Creative CodingTags programming math map processing arduino range

Post navigation

Previous Previous post: 20 Challenges
Next Next post: rdqcutils Quartz Composer plugin