map-clip-copy2

hio/nwt-gus-hi/map-clip-copy2

Projects a number from one range to another preserving ratio. Then clips a result to the target range.
map-clip-copy2
@/map-clip-copy2
Projects a number from one range to another preserving ratio. Then clips a result to the target range.
Xnumber
The value to map and clip.
Sminnumber
Source range lower bound
Smaxnumber
Source range upper bound
Tminnumber
Target range lower bound
Tmaxnumber
Target range upper bound
map-clip-copy2
OUT
X
Smin
Smax
Tmin
Tmax
OUTnumber
The resulting mapped and clipped value of `X`.

Previously known as xod/core/map-clip-range.

To use the node in your project you should have the hio/nwt-gus-hi library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

Tabular tests

XSminSmaxTminTmaxOUT
001-1010-10
0.501-10100
250101010
-10010100
0.5010InfInf
0.501-InfInfNaN
Inf0101010
-Inf010100
NaN01010NaN
0.5011005
-10110010
100011000