cermmid Posted March 2, 2016 Share Posted March 2, 2016 I'm using Houdini 15, and i'm following CmiVfx Connections tutorial, chapter 4 where you create sphere and grid and a vop sop wich is suposse to tell which point from the sphere is closest to which point on the grid. I know things changed with the latest H release, and i thought i kind of a figured it out, but all i get is constant number and it's not point number that is closest to anything. I'va attached the file, if anyone can look inside and tell me what i'm missing? nearestPTNUM.hip Quote Link to comment Share on other sites More sharing options...
bunker Posted March 2, 2016 Share Posted March 2, 2016 in a attrib wrangle: i@closestpoint = nearpoint(1,@P); 1 Quote Link to comment Share on other sites More sharing options...
cermmid Posted March 2, 2016 Author Share Posted March 2, 2016 thank you so much Bunker! so easy.. still got a loooot to learn. and how about other attributes like distance between 2 points, normals, position, color, alpha? can it all be done in attribute wrangle node or is this suposse to be done in pc import? Quote Link to comment Share on other sites More sharing options...
bunker Posted March 3, 2016 Share Posted March 3, 2016 getting attributes is easy, now that you have the point number, you can use the "point" function: int closestpoint = nearpoint(1,@P);v@Cd=point(1,"Cd",closestpoint); or in just one line:v@Cd=point(1,"Cd",nearpoint(1,@P)); using pointclouds you can limit the search radius: float radius = 1;int maxpoints = 1;int handle = pcopen(1,"P",@P,radius,maxpoints);// import Cd from first point from second input@Cd = pcimportbyidxv(handle,"Cd",0); you'll have to replace pcimportbyidxv if the attribute is a float for example: pcimportbyidxf or in one line: @Cd = pcimportbyidxv(pcopen(1,"P",@P,1,1),"Cd",0); getting the distance is easy: vector P2 = pcimportbyidxv(pcopen(1,"P",@P,1,1),"P",0); float dist = distance(@P,P2); 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.