point looping in vex

   3204   5   0
User Avatar
Member
24 posts
Joined: April 2017
Offline
HI.
I have two sets of points and I want to find closest point in the first set for each point in the second set. each point in the first set should be used only once. the wrangle should output the first set with new locations for some of the points.
if I use a point wrangle to iterate trough the first set I cant put the points in the second set to any group (so I could check which is used and not), atleast I could not get this working, I had the second set as second input to the wrangle.

I ended up doing this with detail wrangle (running only once), but this method is slow.
but I was able to put used point ids to an array and use only the unused ones.
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
I don't understand exactly what your problem is. But this sort of thing should be easily done in a wrangle.

Post your hip file, maybe it's just your syntax/logic of the code.
User Avatar
Member
24 posts
Joined: April 2017
Offline
well the main point is that I have scattered points and then a shape and I want some of the points to move evenly across the shape. Ive done this by scattering a second set of points, now the problem is how I match which point goes where
Edited by kojala - May 29, 2017 10:18:06
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Still not clear on exactly what you want to do, but posting a hip file will help in order to possibly show an example of what you could do.
User Avatar
Member
24 posts
Joined: April 2017
Offline
I really cant show the file, but Ill try to be more clear. I have a bunch of points which Im going to use as voronoi points and in the end Im using the original points as rest points and the new points as template points for the transformpieces node. so I want some of the pieces to cover a shape. first I tough not just randomly but evenly as scatter does it. but I could choose number of closest ones and then just move point by point to new locations. that might be the best solution. even my current slow method isnt that bad as the slow detail wrangle is run only if the points change but I have a faster point wrangle later which does the animation just by lerping between old/new position
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Ok…I re-read your original post too.

The reason it won't ‘work’ in run over mode is because your only want a point selected from one set to be selected only once.

In runover mode setting up the loop/conditional for that necessitates you somehow know what was ‘done’ to a previous point.

But runover is trying to work on as many possible points as it can concurrently ( I think I've read elsewhere in this forum it works out to something like 6 at a time ).

What your wanting to do is inherently single threaded, so trying to do it in run over mode just won't give you any more efficiency(maybe).

But it still should work in run over mode. Even if a point is selected more than once and assigned to a group or a user attribute set to a certain value, in the end it will only have that one setting.

It won't appear multiple times.

Which is why I'm not clear about why you say it doesn't work in runover mode. Maybe I'm missing something.
  • Quick Links