Search - User list
Full Version: multiple conditions in IF statement?
Root » Houdini Indie and Apprentice » multiple conditions in IF statement?
olivierth
Hi!

I'm trying to use an IF statement to select all the vertices in the 0 to 1 UV space (u and v). So how can I do these conditions within one If statement:

group:
- u > 0
- u < 1
-v > 0
-v < 1

Thanks for any help!

-Olivier
BabaJ
if( (u > 0) && (u < 1) && (v > 0) && (v < 1) )
{
// do something
}
olivierth
Great! thanks.

if((@uv.x > 0) && (@uv.x < 1) && (@uv.y > 0) && (@uv.y < 1))
    {
    @group_center = 1;
    
    }

-Olivier
olivierth
I see people using symbols like &, ?, upright slashes(dont even know how to do that one) in IF statements. Is there a list somewhere so I can check the effect of each one?

For example, how can I simplify those 2 IF statements into a single one:

if(dot > 1-tresh)
    {
    @group_sides = 1;
    }
if(dot < -1+tresh)
    {
    @group_sides = 1;
    }

Thanks.

-Olivier
Andr
olivierth
For example, how can I simplify those 2 IF statements into a single one:




with the || upright slashes indeed . It means OR


if(dot > a || dot < b)


http://www.sidefx.com/docs/houdini/vex/lang#statements [www.sidefx.com]
Andr
I'm sure you can further compress that statement using “dot” only one time, instead of repeating it. But don't rmb how to do.
olivierth
Thanks!

-Olivier
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB