Jump to content

Distance Expression Query


Recommended Posts

I recently saw an example of someone having used the distance expression to isolate a point on a separate geometry which shared the same position.  They used it in the following expression:

 

if(distance($TX, $TY, $TZ, point("../each1", 0, "P", 0), point("../each1", 0, "P", 1), point("../each1", 0, "P", 2)) == 0,1,0)

 

When the delete node was put to 'delete non-selected' it seemed to have the desired effect of deleting all the points from the incoming geometry, except the one sharing the precise location as point 0 from the 'each1' node.  What I can't make sense of is why the distance is 0, 1, 0 and not 0, 0, 0, as I would've thought that there should be no distance between them.  I hope I've explained this clearly enough to make it make some sense - I've included a hip file beneath - but if anyone could give me an answer then I'd be really grateful as I've been puzzling over it for weeks!

 

Many thanks

 

Toby

distanceExpressionMystery.hipnc

Link to comment
Share on other sites

I think it's just about the if statement:

if(condition, do this if True, do this if False) so

if(distance is equal to 0, set to 1, otherwise set to 0)

actually condition = distance($TX, $TY, $TZ, point("../each1", 0, "P", 0), point("../each1", 0, "P", 1), point("../each1", 0, "P", 2)) == 0

if(distance($TX, $TY, $TZ, point("../each1", 0, "P", 0), point("../each1", 0, "P", 1), point("../each1", 0, "P", 2)) == 0,1,)

I suppose isn't necessary the "if" statement, it should works putting the condition itself and the answer will be 1 for True and 0 for False, but I may be wrong

Link to comment
Share on other sites

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...