Search the Community
Showing results for tags 'nearest'.
-
Hi ! Just like in the title, I need to find all the nearests primitives from a point and put them into an array ! I tried with the "xyzdist" fuction and other techniques but still doesn't work :"/ Do you guys have an idea on how to solve this ? Thank you all !
- 5 replies
-
- array
- primitives
-
(and 3 more)
Tagged with:
-
Hi, I'm trying to find a couple of nearest points, the problem is I want to avoid duplicates - so let's say point no.1 finds their nearest points (lets say no. 17, and no. 39) I don't want them to be included into nearest search anymore. To be honest I can't tell what am I doing wrong ( I suspect some stupid error or groups not updating until code is finished). No matter what I do - I still have points included in my search. Here is my piece of code - that I use in "Detail Wrangle". Then it's used inside a for loop (node based) to control number of iterations (it simulates growth). Scene file also included. Any clues on that? int branches = 2; int seeds[] = expandpointgroup(0,"seed"); foreach( int seed; seeds) { setpointgroup(0,"seed", seed, 0); //remove point from seeds setpointgroup(0,"used", seed, 1); //mark point as used vector pos = pointattrib(0,"P",seed,1); //get seed position int nearpts[] = nearpoints(0,"!used !seed",pos,2,branches); //search within not used points, //this should prevent finding duplicates foreach (int nearpt; nearpts) { addprim(0,"polyline",seed,nearpt); //draw a line setpointgroup(0,"seed", nearpt, 1);//make new point as a seed } } duplicates.hipnc
-
Hey, I'm sure this has been asked numerous times, but I've looked through past posts and can't seem to piece together enough info. Trying to use point clouds to find the nearest point for each point, and then the nearest for the previous found point and so on. Want to create ordered points to connect with the add sop, based on the nearest points to each individual point - creating one curve from ordered points. I'm aware the sort sop can sort by spacial locality, but it behaves strangely (spatial locality to what?) would like to set this up in vops. Any help appreciated - ta.
-
Hi, I have a grid of maybe 1000 triangles which are coloured black. I colour a few points white and use a point cloud and solver to spread the white colour throughout the grid. My intention is that once the triangle primitive turns white it flips 180 degrees. The rotation of the triangle should be such that triangle appears to be rotating away from the white colour. The tricky part is that I can't be sure on which way (and therefore which axis) the triangle will need to flip. My thinking so far is this: Iterate over all black triangles (in vop sop or point wrangle) and find the nearest white point Find the two points within that triangle that are furthest from my found white point Set the vector of those two points as my rotation axis Flip triangle It seems fairly simple but i'm struggling a little bit, and its an interesting topic finding the nearest point with an attribute above a certain value. I've attached a simple hip file to illustrate what I mean (and a vop sop with a half baked idea!) Cheers, Mike flip_test_v1.hip