Clustering geometry per attractors and assign color

I need some help to resolve part of this script that I can not figure it out. Here is the summary about this script and what I am trying to accomplish;

_There is a grid with 600 square block and three attractor points named A; B and C.
_I have clustered the blocks into 3 sectors based on their distance to attratctor points.
_Furthermore I need to cluster blocks within a sector into 9 sub-groups based on block distance to attractor point within same sector.
_Problem: this the part I am having issue. My goals to assign color to each sub-group within the sectors. So there will be 9 colors and each color will be assigned to a sub-group.
_see attached script.
Thanks,
ClusteringGeometry_v0.gh (21.6 KB)

Hi,

ClusteringGeometry_v1.gh (33.6 KB)

Hi diff-arch;

Thanks so much, this is what I was looking for. However, It looks like some of the blocks at upper left and lower middle of grid are not getting the right color. These blocks are getting the same color as the one close to attractor points. I will look into it. see attached image.

Thanks!
-sharif

That’s because you’ve defined the left colour of your first gradient sample point and the right one of the last sample point as the same orange colour!

Thanks! it worked. One last question, is it possible to use 9 specific color with color swatch component instead of gradient componentClusteringGeometry_v2.gh (17.8 KB)

Yes, like so:

ClusteringGeometry_v3.gh (20.6 KB)

Hi diff-arch;

Thank you so much for helping and this is the result I was looking.
-sharif

Hello there, old post new questions, how would it be to assign a single color for each attractor point and then have this diffuse and round borders between the three points.