Processing has a function map
that
Re-maps a number from one range to another.
For example
int ans = map(5, 0, 10, 0, 100);
ans
will be 50
as 5
is halfway between 0
and 10
and halfway between 0
and 100
is 50
.
If there is no built in function how would I write my own one?