Posts on EddyNottingham
https://eddynottingham.com/posts/
Recent content in Posts on EddyNottinghamHugo -- gohugo.ioen-ukWed, 28 Feb 2024 00:49:28 +0200Mapping a Value
https://eddynottingham.com/posts/mapping-a-value-from-one-range-to-another/
Wed, 28 Feb 2024 00:49:28 +0200https://eddynottingham.com/posts/mapping-a-value-from-one-range-to-another/Mapping a value from one range to another is commonly used in game development. Here is some information about this process that you can use to inform you in making your own tools, and also some code you can simply copy.
The Maths If I’m mapping the range $[a, b]$ onto $[c, d]$ with an input value of x, then: $$y = (x - a) \left( \frac{d - c}{b - a} \right) + c$$