What's the best approach to get a ring of points on a mesh?

What's the best approach to get a ring of points on a mesh?

mcw0
Advisor Advisor
622 Views
13 Replies
Message 1 of 14

What's the best approach to get a ring of points on a mesh?

mcw0
Advisor
Advisor

I have an island of points.  In Maya, if I "shift>", I can expand my selection.  After repeating "shift>" a few times and deselecting my original island of points, I'm left with a ring of points.  This is what I want.

I see "get_points_in_radius".  That appears to return locations (not what I want) and point indices (what I want).  And there's also "sample_closest_in_radius_accelerator" which only returns point indices.  In either case, if I feed in my island of points, just using a radius will mean I will have to exclude my island points from the resulting indices.  Which way is the most efficient for what I want to do?  Is there another option I'm not aware of?

0 Likes
Accepted solutions (1)
623 Views
13 Replies
Replies (13)
Message 2 of 14

mcw0
Advisor
Advisor

"get_points_in_radius" took awhile but I got what I wanted.  I couldn't get the "build_closest_accelerator" to work.  How do I set the geo component to points?  I left it blank and maybe that's why I'm not getting anything.  I would like to speed up the graph so maybe this accelerator is the way to go.  Just need to know how to set the geo component.  Help?

0 Likes
Message 3 of 14

mcw0
Advisor
Advisor

My next problem:

Now that I have my indices from "get_points_in_radius", this also contains indices for the original island of points.  I tried "remove_from_array" to remove the original indices.  But nothing happened.  My point scope is still showing the results from "get_points_in_radius".  I was expecting to get a ring of points around my original island.  What did I do wrong?

0 Likes
Message 4 of 14

mcw0
Advisor
Advisor

So geo component should be set to "point_component".  Much faster than the "get_points_in_radius".  Still don't know why I can't remove my original array of indices from the resulting array of indices.

0 Likes
Message 5 of 14

mcw0
Advisor
Advisor

I just noticed that the point index output type of both the "get_points_in_radius" and the "sample_closest_in_radius_accelerator" are "array<array<long>>".  Why a double array?  Now this propagates throughout my graph.  Is this why I'm not getting what I expect?  How do I convert this output to just "array<long>"?  Or do I need to?

0 Likes
Message 6 of 14

mcw0
Advisor
Advisor

This is so frustrating.  I could've coded this hours ago in MEL.  It would be really slow but at least the code would be done.  Then maybe I can use ChatGPT to convert it to Bifrost.  LOL!!!

I have an island of points as my starting data set.  I want to get a falloff ring of points around that island.  That's it.  Really simple.

0 Likes
Message 7 of 14

mcw0
Advisor
Advisor

I tried connecting the resulting point_index to my output and then printing the values.  And found out that it's a "compound with mixed type elements"!  Is this why I couldn't use "remove_from_array" to get the indices of only the ring points?  How do I convert this compound output to something useable?  

0 Likes
Message 8 of 14

mcw0
Advisor
Advisor

I am so confused.  I downloaded the dent_bulge example and found the "sample_closest_in_radius_accelerator" node and its "point_index" output is "array<long>".  WHAT???!!!

 

Why is mine saying it's "array<array<long>>"?  I GIVE UP!

So just out of curiosity, I created another "sample_closest_in_radius_accelerator" node in the dent-bulge graph and sure enough, the point_index output is "array<array<long>>".  I REALLY GIVE UP NOW!

0 Likes
Message 9 of 14

sepu6
Advisor
Advisor

Is this what you want?

0 Likes
Message 10 of 14

mcw0
Advisor
Advisor

I was able to get as far as what you've shown.  What I want is to subtract the starting island of points and end up only with the ring.  Let's say the island of points is full value of 1.  And the ring falls off to zero over a set distance.

0 Likes
Message 11 of 14

mcw0
Advisor
Advisor

A good night's sleep does wonders.  So the issue with point_indices being an "array<array<long>>" is because my input is an array of points.  So the output is an array for each point.  I thought it would concatenate and remove duplicates and output only one array.  Ok, so feeling better today.  Fingers crossed.

And there just happens to be a "sort_array_and_remove_duplicates"!  It's almost as if someone encountered my issue before.  LOL

0 Likes
Message 12 of 14

sepu6
Advisor
Advisor

Just control that with a fcurve 

 

maya_t8GEYRgTVi.png

Message 13 of 14

mcw0
Advisor
Advisor
Accepted solution

FINALLY!  What a nightmare!  I can't believe there isn't a node to just subtract one array from another.  Meaning, do a difference of 2 arrays.  The "remove_from_array" is based on indices.  WHY?!  Why the extra step to get the indices you want to remove?  Why not just remove the value?  Simple, straightforward.  UGH!!!

FINALLY.png

Message 14 of 14

sepu6
Advisor
Advisor

There is probably a more straightforward/easier way to do what you want but if you do not share what you got then I'm just playing the guessing game ...