Normalize X in Start..Stop. Clip X. Output is Norm (0..1.0).
Start is 0 of Norm, Stop is 1.0 of Norm.
X=-2, Start=10, Stop=0 then Norm is 1.2.
Normalize= (X-Start) / (Stop-Start)
Sdiff : +..+..--..--
Tdiff : +..--..+..--
Norm=+..--..--..+
normalize
@/normalize
Normalize X in Start..Stop. Clip X. Output is Norm (0..1.0).
Start is 0 of Norm, Stop is 1.0 of Norm.
X=-2, Start=10, Stop=0 then Norm is 1.2.
Normalize= (X-Start) / (Stop-Start)
Sdiff : +..+..--..--
Tdiff : +..--..+..--
Norm=+..--..--..+
Xnumber
Value to map
STARTnumber
Source range begin bound
STOPnumber
Source range end bound
OUTnumber
Normalize as Duty (0..1.0)
To use the node in your project you should have the koadrobot/aritmatics 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.
C++ implementation
#pragma XOD dirtieness disable
struct State {
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
Number x = getValue<input_X>(ctx);
Number start = getValue<input_START>(ctx);
Number stop = getValue<input_STOP>(ctx);
Number outX = (x-start)/(stop-start);
emitValue<output_OUT>(ctx, outX);
}