I have a grid and 3 points that act as attractors. After evaluating all the distances between the attractors and the grid, I want to select the 1st X cells closest to all 3. Instead, I am getting the first x cells for each individual attractor. For example, let’s say I need the closest 9 cells to the attractors, how can I sort the list according to all the distances computed?
@jeff_hammond, our results appear to be a bit different using the same attractor points? I was a little confused by the wording too. “The first X cells closest to each attractor point” is how I interpreted it.
Later… @jeff_hammond, never mind! I figured out why they were different; your HexGrid dimensions were different from mine. Well done!
Thanks everyone for your efforts. It seems we are all achieving the same results. I can get x number of cells to populate along each “attractor” easily. The challenge is that I have a limited number of x to distribute to ALL the attractors.
So I’m trying to get the algorithm to go 1st closest to each point, then 2nd closest, then 3rd closest until the run stops when we’ve done this x times… I hope this is clearer…?
I was thinking one way to do this would be to grab all the distances betwen each attractor point and each cell and re-sort them based on distance lengths. Then let’s say, grab the first x in the sorted set and reparametrise somehow so that only those 1st x (or range) are picked. That’s where I’m stumped.
pull point (and the other pull components) has a different algorithm that when set in closest mode only returns the distance to the closest pulling geometry. So if you have 3 attractors, it measures distance of each grid point to each attractor and returns only the closest distance, rather than all 3 distances.
that is very useful to know! In this case, we are giving x 1st cells to the attractors. This works just as intended. In the 2nd round, we want to give another x cells around the attractors. Essentially, I am trying to give certain categories around the attractors where the numbers are already predefined. I have x y z of each category a b c. A will be the closest, then B, then C. Again, I think this is more of a math challenge than implementation…I’m trying to think this through here. Thanks for your help on this!