norm()

Math / Calculation

Description

Normalizes a number from a range into a value between 0.0 and 1.0.

Syntax

float norm(float v, float lo, float hi)

Parameters

NameTypeDescription
vfloatincoming value
lofloatlower bound
hifloatupper bound

Returns

float

Related

Under the Hood

From Processing.h:

static float norm(float v, float lo, float hi) { return (v-lo)/(hi-lo); }