Reference norm()

norm()

Maps a number from one range to a value between 0 and 1.

For example, norm(2, 0, 10) returns 0.2. 2's position in the original range [0, 10] is proportional to 0.2's position in the range [0, 1]. This is the same as calling map(2, 0, 10, 0, 1).

Numbers outside of the original range are not constrained between 0 and 1. Out-of-range values are often intentional and useful.

Examples

Syntax

norm(value, start, stop)

Parameters

value
Number:

incoming value to be normalized.

start
Number:

lower bound of the value's current range.

stop
Number:

upper bound of the value's current range.

Returns

Number: normalized number.
Notice any errors or typos? Please let us know. Please feel free to edit src/math/calculation.js and open a pull request!

Related References