Jump to content

How to Exclude Group in VEX?


F10

Recommended Posts

Hi everyone,

 

I have a small problem I can't figure out. I can't  find a clear answer online:

I have different group on different points, I want to find the point using nearpoint() function, it's clear in the documentation how to look into a group of points :

int  nearpoint(<geometry>geometry, string ptgroup, vector pt)

but how would you go about looking for points excluded from this group, keeping in mind the groups are created according to the @id of the original point so I can't pinpoint and exact group name.

It as to exclude the group of the point behind processed.

here is what I have for now :

string grp = 'grp_' + itoa(i@id);
setpointgroup(0, grp, @ptnum, 1);

i@nearpt = nearpoint(1, grp, @P);

that will select the point within the processed point's group

how to find points excluding all points from this group?

 

thanks a lot!

 

 

 

Link to comment
Share on other sites

like in any other group parameter

if group name is 'grp_0' then not that group would be '!grp_0'

however it would be inefficient o be creating groups per point, since you can use point numbers directly for a group, '0' and '!0'

also if you just want to always exclude current point, then instead of using groups it's better to just find closest 2 point using nearpoints() and then remove first from the array, but again it depends on what you are doing I may be just assuming stuff based on example

Link to comment
Share on other sites

17 minutes ago, anim said:

like in any other group parameter

if group name is 'grp_0' then not that group would be '!grp_0'

however it would be inefficient o be creating groups per point, since you can use point numbers directly for a group, '0' and '!0'

also if you just want to always exclude current point, then instead of using groups it's better to just find closest 2 point using nearpoints() and then remove first from the array, but again it depends on what you are doing I may be just assuming stuff based on example

Thanks Tomas,

I see, it works, but the issue I have with this solution is that the group number is different according to each point so I'd need a way to change the group number in the string in the nearpoint function.

Here is a screengrab of the situation: in short I have a slover moving points according to a vector. Each point is creating a line, I'm grouping the points per line. When a line interesct, it's getting the vector of the intersected point from the other group and change direction accordingly.

On the screen grab, point 76 from grp_2 is intersecting with the other line. I'm getting a correct result from your solution pointing 'grp_2' in the nearpoints() function.

Is there a way to make the group number in this string procedural according to the processed point?   ---->something like   '!grp_@id' ??? maybe :)

 

Yup, I did the nearpoints array removing the 1st point, it does work.

 

Florian

GroupExcludeVEX.JPG

Link to comment
Share on other sites

6 minutes ago, F10 said:

Is there a way to make the group number in this string procedural according to the processed point?   ---->something like   '!grp_@id' ??? maybe

yes, exactly as you had it, just combine with the ! as mentioned to negate the group

string grp = '!grp_' + itoa(i@id);

 

Edited by anim
Link to comment
Share on other sites

44 minutes ago, anim said:

yes, exactly as you had it, just combine with the ! as mentioned to negate the group


string grp = '!grp_' + itoa(i@id);

 

Actually, that didn't give the excepted result. Adding '!grp_' to the string kills all the groups as per this screenshot :

GroupExcludeVEX_01.thumb.JPG.9e14bd2c457c2d0906b436cba8cbfa73.JPG

 

This options works better but somehow the point 70, 3rd on the array is from the same group as pt 76 and is showing in the selected points. it's pretty close tho.

GroupExcludeVEX_02.thumb.JPG.13eb15af71f1cf0e29a774e8b56fe188.JPG

 

Edited by F10
Link to comment
Share on other sites

You can't set those groups in the same wrangle as nearpoint is looking at the input geo, the groups have to exist on the input geo so split it in 2 

Also when you are setting the group don't use ! in it's name, that's just to negate the matching pattern

Link to comment
Share on other sites

6 hours ago, anim said:

You can't set those groups in the same wrangle as nearpoint is looking at the input geo, the groups have to exist on the input geo so split it in 2 

Also when you are setting the group don't use ! in it's name, that's just to negate the matching pattern

Hey Tomas,

I'm not getting much luck on this. It's still getting points from the same group in the array. I guess I'm missing something obvious, if you have 5mn, I've attached the hip file...!

Thanks a lot

Florian

VEXgrp_01.hiplc

Link to comment
Share on other sites

in find_nearpoints replace this

i[]@nearpts = nearpoints(1, "!grp", @P, .1, 4); 

with this

string grp = "!grp" + itoa(i@source);
i[]@nearpts = nearpoints(1, grp, @P, .1, 4); 

or alternatively you can completely bypass your set_lines_grp as you don't need to have those groups, because you can use ad-hoc group syntax in nearpoints directly:

string grp = "@source!=" + itoa(i@source);
i[]@nearpts = nearpoints(1, grp, @P, .1, 4); 

 

VEXgrp_01_fix.hiplc

  • Like 1
Link to comment
Share on other sites

19 minutes ago, anim said:

in find_nearpoints replace this


i[]@nearpts = nearpoints(1, "!grp", @P, .1, 4); 

with this


string grp = "!grp" + itoa(i@source);
i[]@nearpts = nearpoints(1, grp, @P, .1, 4); 

or alternatively you can completely bypass your set_lines_grp as you don't need to have those groups, because you can use ad-hoc group syntax in nearpoints directly:


string grp = "@source!=" + itoa(i@source);
i[]@nearpts = nearpoints(1, grp, @P, .1, 4); 

 

VEXgrp_01_fix.hiplc

A big thanks to you Tomas,

That does to trick nicely indeed.

 

Keep safe!

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