Jump to content

can't select diagonal of a grid with expression


WLVL

Recommended Posts

Huh, you're right, looks like a subtle rounding error with absolute and the if statement. Happens in your setup too konstantin if you put an abs vop on each wire before the equality test.

 

Might be worth sending to sidefx support a a bug.

 

In the interim, you can make it work if you subtract one from the other, and test if its within a very small range. Eg, for the group expression:

if( abs($TX)-abs($TZ)<0.0001  && abs($TX)-abs($TZ)>-0.001, 1 ,0 )

Or directly in a wrangle (slightly easier to read I reckon) :

 

float diff = abs(@P.x)-abs(@P.z);
float max = 0.001;
float min = -max;

if (diff<max && diff>min) {
  @Cd={1,0,0};
  @group_group1=1;
}
Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...