If input `X` is between the threshold `T0`, `T1`, ..., `T𝑛` then output is the ROUND threshold. If `X` is even greater than the last threshold, the value is round down to it.
discretize(round)
@/discretize(round)
If input `X` is between the threshold `T0`, `T1`, ..., `T𝑛` then output is the ROUND threshold. If `X` is even greater than the last threshold, the value is round down to it.
Xnumber
Input Value that will be discretize.
T0number
T1number (variadic)
Tnumber
The rounding result. Equals to one of Tx.
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) {
auto x = getValue<input_X>(ctx);
auto t0 = getValue<input_T0>(ctx);
auto t1 = getValue<input_T1>(ctx);
emitValue<output_T>(ctx, (x < (t0+t1)/2) ? t0 : t1);
}