DeBrumaire Posted January 27, 2022 Share Posted January 27, 2022 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 ! Quote Link to comment Share on other sites More sharing options...
animatrix Posted January 27, 2022 Share Posted January 27, 2022 Hi, You can write something like this in a Primitive Wrangle: float dist = ch("dist"); dist *= dist; vector p = point ( 1, "P", 0 ); if ( distance2 ( @P, p ) < dist ) i@group_near = 1; 1 Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted January 27, 2022 Share Posted January 27, 2022 .. and use expandprimgroup() to create an array. Quote Link to comment Share on other sites More sharing options...
DeBrumaire Posted March 9, 2022 Author Share Posted March 9, 2022 Haha thank you two for your answers ! Quote Link to comment Share on other sites More sharing options...
animatrix Posted March 10, 2022 Share Posted March 10, 2022 FYI the above approach I showed is naive, meant for one-off usage. But if you want max performance, I would recommend creating points to represent primitives and use pcfind instead and using this only include those primitives in the group, which would be much faster. Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted March 10, 2022 Share Posted March 10, 2022 .. perhaps like so: array_near_prims.hipnc 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.