Hello,
I'm using a group node with filter expression.
Does anyone know an expression to select only the ‘even’ primitive numbers of my input grid ?
thanks,
bern
filter expression
7492 3 1- Bernard
- Member
- 523 posts
- Joined: July 2005
- Offline
- graham
- Member
- 1921 posts
- Joined: Nov. 2006
- Online
- whalerider
- Member
- 194 posts
- Joined:
- Offline
Yep, what Graham suggested is what you need.
Basically, you need to know what variable carries information about primitive number. It's $PR - see Local Variables under hdox/houdini/content/helpcards/sop/primitive.html
Then you need to find whether the primitive number is divisible by 2 or not.
For that you need the modulus function (%) - which gives you the remainder
of dividing one number by another number. If the remainder of division by 2 is 0, you know you're dealing with an even number.
Hence, the expression is $PR%2==0 (== checks whether a condition is true, = is the assignment operator, so make sure to use =
Basically, you need to know what variable carries information about primitive number. It's $PR - see Local Variables under hdox/houdini/content/helpcards/sop/primitive.html
Then you need to find whether the primitive number is divisible by 2 or not.
For that you need the modulus function (%) - which gives you the remainder
of dividing one number by another number. If the remainder of division by 2 is 0, you know you're dealing with an even number.
Hence, the expression is $PR%2==0 (== checks whether a condition is true, = is the assignment operator, so make sure to use =
- Dean_19
- Member
- 319 posts
- Joined:
- Offline
-
- Quick Links