Jump to content

VOP SOP nearest point


Alkos

Recommended Posts

Hi all,

I'm still working with VopSop tools.

Now I'm trying to move the points (with a "mix" parameter) of my first geometry to the nearest point of the second geometry.

here are 2 snapshots of my VOPsop: the "base" and the "for loop".

vop_Level_image

forLoop_Level_image

So, What I try to do is:

for each point of the first entry I'm trying to compare the distance between that point and all other points of the second entry. I would like to do a forLoop which return the nearest point position of the second geometry.

then I mix the two position with a "shift" parameter.

In the forLoop what I try is: for each point of the 2nd geometry, get the position value, compute the distance between the current position and this point, if it's smaller than the "distance" parameter (initialized at 10000) then distance is equal to this new distance value, and position is equal to this new position (outputing in "result" parameter)

But... it doesn't work !! :rolleyes:

I still don't understand which value does a loop and wich doesn't ! it's really annoying !!

Any help, or explanation would be really welcome

thanks

Hip File

Link to comment
Share on other sites

there are several errors in your vops:

1. import attribute Npt from second input does nothing because Npt is not an attribute, you can use parameter instead and then bind it to npoints() expression

2. the test for distnce (less than) outputs 1 when currently tested point is closer, but you are setting new distance and result point position when the switch is 0 so you should swap the inputs in both switch vops

3. you should inicialize result position instead of using P of current point because it will put this P in result position every time the tested point is further from current point than your found minimum distance and thus it will reset your found position to P.

look at the fixed file

i disabled your custom asset Alkos_pointMover1 since i do not have its definition

nearestPoint_fix.hip

Link to comment
Share on other sites

Hi, and sorry for the late of my answer (I was busy this weekend)

thank you for your time and the hip file. it's really useful !

that 's exactly what I tried to do.

you're definitively my vex tutor ;) I learn a lot with your help. Specialy I had no idea that Npt didn't work.

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