Comparator actor behaviour ?
-
Speaking of which... I think I remember a tutorial from Mark speaking about the order of operation but is there, like in Max, a way to clearly define the order by placing the actors spatially ?
-
What do you say with placing actors spatially ? I don't find mark's tutorial which way is it ?
-
Isadora does process actors from top to bottom so it will have a slight delay.
-
Out of curiosity I tried this as well. I have no idea for the purpose of this.
It seems that there are both true and false triggered sometimes. However Comparator output value will be either 1 or 0 and correct to equation(as far I can tell). - 1=true 0=false. You can use this output instead. Like add one more comparator that will compare first ones output with 0 or 1 and get true /false trigger. -
sure it's a solution to have only one result but the logical result sometimes is wrong because this state change on new true / false trigger. You have a 0 and quickly a 1, it's not stable output.
exemple : put 2 value ( ie 35 and 56) to create a rectangle. I need a true when value 1 < value 2 (ie to choose rectangle horz or vert move according to shape dimension). Who use comparator actor to make this ?
-
Dear nZo,
You are generating two random numbers. They come in one at a time. So imagine that the Comparator has these two values and is set to greater than (>)105Now you generate two random numbers. The first random number is 3.2 and so it arrives at value13.25at this moment, the output if false (0) and the 'false' output triggersNow the next random number comes (for value2) and it is 1.8, so now we have3.21.8and the result of the comparison is true the 'true' output triggers.Does that help you to understand what's happening?I can see however that this is confusing. I will file a bug report on this topic and make sure we look into it.Best Wishes,Mark -
Coming from Max, that was right what I imagined. So now my question is : is there an actor that can do what [pack] or [pak] objects do in Max ?
-
I have been using Javascript to pack and unpack from JSON strings.
-
Thanks Mark for detailed explanation.
Actor's behavior seems logical. Process execution speed did not allow me to see what happens, look like both result.
perhaps made on a dev code a short delay before analyse theses values for case 2 values put in on same (relative) time ...
-
Had a flight this morning so spent 15 mins doing a quick inelegant but reliable patched solution to your problem.
The thing is you are changing the numbers in your comparator one at a time giving you 3 combinations of numbers.
Ie you start with numbers A & B and end with C & D giving you the following sequence of changes.
AB
CB
CD
So of course you get a true/false outcome for each combination.
By ignoring the changes and then simply comparing the final pair you will get what I think it is you are after.
First solution that came to mind is patched and attached.
Hope it helps.
Dan
BTW: in the patch trigger delay 2a and 2b need to be longer than trigger delay 1 but don’t need to be the values I have set. (the process needs at least .2 seconds to complete though i.e. min vals of 0.2 & 0.4 – on my laptop anyway)
I have also set initialize values for the toggles and gates.
-
SS of above
-
A clean fix using Javascript actor.
function debug(printString) { if (DebugMode){ print(printString + "\n"); } } function main() { DebugMode = true; op = parseInt(arguments[0]); // op 1, lessthan // op 2, greaterthan in1 = parseFloat(arguments[1]); in2 = parseFloat(arguments[2]); debug("1= " + in1 + " 2= " + in2); if (op === 1){ if (in1 < in2) { opOut = 1; debug("out1= " + opOut); }else{ opOut = 0; debug("out2= " + opOut); } } if (op === 2){ if (in1 > in2) { opOut = 1; debug("out1= " + opOut); }else{ opOut = 0; debug("out2= " + opOut); } } outVals = [opOut] debug("vals= " + outVals ); return outVals; }
The attached file shows how I set this up. The above Javascript goes into the JavaScript actor... its basic and needs expanding, but it works. ( @Michel seems like I can't format the Javascript code anymore.. and HTML view auto extends so you can't make edits.)
-
@DusX
Nice!
-
I was surprised that this worked, since I believed that the Javascript would run each time a value arrives,but in fact it seems that all values received during the cycle are used. Is this correct?If so it makes for an easy way to trap incoming values for a synchronized process. -
This javascript version produces the same behaviour as the comparator actor for me - sending two values from random value actors both triggered from a single actor produces the intermediate result when the first input has changed, and the final result when the second input changes.
-
I would use this to give single trigger when both are changing 'simultaneously'. The short delay means the intermidaite value gets lost.
The value on the trigger can be adjusted to a longer delay if it is unreliable. The final comparator can be omitted if you just want the value 0 or 1 from the comparison - it is there to recreate the true false triggers.Nick -
Strange. I expected the js to behave the same. I expected to have to add some logic to require both values be new. ( or like) But I couldn't see any double outputs.
-
Heres monitor output generated - first set of zeros created by changing value 2 to zero (1 was aready set to 0) - so just one output as only 1 input changed.
Then clicked on trigger value at top once which generates the next two sets, where the intermediate 'incorrect' value appears.The final two sets of values (where nothing changes) are generated by changing the value of input 1 from 1 to 2 -
Ok. Well that's really what it should do... I just hadn't noticed and thought it served the purpose. I will write a version that works.. Using the simultaneous actor to trigger the action.
-
@ dusX : I don't know yet how to use javascript but you're caught my attention. I puts me as possible !
@ nick : I return integrate your solution in my rectangle generator and I post the patch right here very soon
@ danshorten : your patch are true but not very stable on result for me . i just keeping searching.A big thanks to all for your help and your efficiency.
nZo