Distances between multiple points on a series of curves and a centroid


So I have a clustered component I have developed to create a unique shaped dependant on an individual voronoi cell. The component works as intended for an individual voronoi cell, but when I attempt to input multiple voronoi cells the process breakdowns.

To briefly describe what is happening, I am taking a voronoi cell, contouring it, and then creating points on each of the contour lines. It then measures the distance of each of those points to the centroid of that voronoi cell, moving the point in the z-axis proportional to that distance.

This works just fine; however, when I apply the whole voronoi field the distance is calculated for each point to all of the centroids which is not what is intended. Each voronoi cell should only calculate the distance of the points of its own contours to its own centroid.

What is the best way to achieve this?

Edit: I solved this with the closet point component, but if there are suggestions to make improvements they will be greatly appreciated as I am still learning grashopper.

voronoi_contours.gh (16.8 KB)

You need trim tree

voronoi_contours2.gh (13.2 KB)

1 Like

First, I grafted the Voronoi output.

Then inside the cluster, I added a Line component (yellow group) using the same inputs as the Distance component just to see what it was measuring. It was not what you wanted so I added a couple of PShift (Shift Paths) components and a Partition component (an impatient and desperate move), and finally skipped the components in the purple group because it wasn’t fun anymore.

voronoi_contours_2020JFeb14a.gh (28.9 KB)

1 Like

Getting the disabled purple group to work properly was very easy.

voronoi_contours_2020JFeb14b.gh (30.4 KB)