Archive for July 15th, 2008

15
Jul

Mathematical Expression Ternary Operator

This is cool! Toby is right, you CAN use the ternary operator in a Mathematical Expression patch. You can even use it to, for example, invert a boolean input. For example:

(Bool == true) ? false : true

works as a a boolean invert. The input and output aren’t recognised as boolean types, so you’ll get orange cables if you attach, say, a bool splitter to the input, and patch the output into the Enable input of a Billboard, for example. It’ll work fine though, and in fact, I often mix number and boolean types in my compositions.

EDIT:
toby*spark pointed out that for the particular case of a boolean invert, an even quicker way of doing it is to simply use

!Bool

In this case, ‘Bool’ will be the input port name (you can use any name you like), and the patch will output true/1 when the input is false, and false/0 when the input is true. Very handy.




 

July 2008
M T W T F S S
« Jun   Aug »
 123456
78910111213
14151617181920
21222324252627
28293031  

Categories

Links

Blog Stats

  • 28,388 hits