The mathematical expression patch is pretty fussy about nesting, I've found
before that it doesn't evaluate these things the way I expect it to. Anyway,
it's fixed by forcing correct evaluation with extra brakets:
((IntegratorResult < Min) && (Value < 0)) ? 0 : (((IntegratorResult > Max)
&& (Value > 0)) ? 0 : Value)

Chris



2009/7/7 Alex Drinkwater <[email protected]>

> Does the Mathematical Expression patch not work with nested ternary logic?
> This:
>
> (IntegratorResult < Min && Value < 0) ? 0 :(IntegratorResult > Max && Value
> > 0) ? 0 : Value
>
> doesn't produce the desired effect when connected to/from an Integrator
> patch (it looks like only the second conditional is evaluated), whereas the
> same logic in a JavaScript patch:
>
> function (__number ToIntegrator)
> main
> (__number Value, __number Min, __number Max, __number IntegratorResult)
> {
> var result = new Object();
> result.ToIntegrator = (IntegratorResult < Min && Value < 0) ? 0 :
> (IntegratorResult > Max && Value > 0) ? 0 : Value;
> return result;
> }
>
> works fine.
>
> Is this a known limitation of the Mathematical Expression patch, and if so,
> is there some workaround to avoid the overhead of using a JS patch?
>
> I've attached a little demo QTZ to show the two methods in action.
>
> Cheers,
>
> a|x
> http://machinesdontcare.wordpress.com
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Quartzcomposer-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
>
> http://lists.apple.com/mailman/options/quartzcomposer-dev/psonice%40gmail.com
>
> This email sent to [email protected]
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to