VEX Dictionary / fit
fit
Remaps a value from one range into another, clamped to the new range.
group: interpinterp
Available in every context
Usage
float fit(float value, float omin, float omax, float nmin, float nmax)
<vector> fit(<vector> value, <vector> omin, <vector> omax, <vector> nmin, <vector> nmax)
Examples
f@mask = fit(@P.y, chf("low"), chf("high"), 0, 1);fit remaps a value from one range into another and clamps it to the new range. Here height becomes a 0–1 mask that you can shape further with a ramp.
Use cases
- Normalising any measurement Turn distance, speed or curvature into a 0–1 value before feeding
chramp.
Signatures (from vcc -X)
float fit(float, float, float, float, float)all contextsvector4 fit(vector4, vector4, vector4, vector4, vector4)all contextsvector2 fit(vector2, vector2, vector2, vector2, vector2)all contextsvector fit(vector, vector, vector, vector, vector)all contexts