Prepare repository for merge

This commit is contained in:
Angelos Chalaris
2023-05-01 22:43:50 +03:00
parent ab1ea476c5
commit a5ca5190e5
169 changed files with 0 additions and 626 deletions

View File

@ -0,0 +1,21 @@
---
title: Map number to range
type: snippet
tags: [math]
cover: round-leaves
dateModified: 2021-04-05T18:25:46+03:00
---
Maps a number from one range to another range.
- Return `num` mapped between `outMin`-`outMax` from `inMin`-`inMax`.
```py
def num_to_range(num, inMin, inMax, outMin, outMax):
return outMin + (float(num - inMin) / float(inMax - inMin) * (outMax
- outMin))
```
```py
num_to_range(5, 0, 10, 0, 100) # 50.0
```