I’ve got a list of values (shown in the Watch node), and I’d like to generate the distance & direction to the nearest value from the sequence.
for example, the new list would read:
- 100
- -50
- -100
- 50
etc
I’ve got a list of values (shown in the Watch node), and I’d like to generate the distance & direction to the nearest value from the sequence.
for example, the new list would read:
If you’re comparing to an actual sequence (equally spaced values) then you can just round to that specified precision and then take the difference from the original value.
How would I go about that? The OOTB rounding nodes I found only concerned themselves with digits, rather than rounding to a specific figure from a sequence?
Just a little math:
Math.Round(value/precision)*precision;
ah fantastic thanks, I’m very new to Design Script so this is perfect