Im not sure how to approach this one. The idea is to start with a bunch of points (say 100).

I want to find groups of points among the total set. So for example have an input of 5 and the definition finds 5 groups of equal size among the total 100. I am ultimately interested in finding “groups” that are clusters of points such that the cluster is made up of a subset of points that are the close to other points. Ill attach a simplified sketch with 30 points of what I mean below because that might not have been clear.

In the end the idea is to interpolate the external points of a cluster so that each group is enclosed by a curve that isnt intersected by another group’s exterior curve. (Kind of similar to “The Potato Plan” by Kees Christiaanse)

In the future the idea is to apply this to a 3D point cloud with a brep shell around them instead of a curve around a 2D point set, but I think its smart to start simple.

Any ideas how to approach this?

Thank you very much ahead of time to all those that give input

I thought this might be the way to go, but I cant figure out how to use the component or make a definition from it, and theres limited information about it online.

Lets say pop2d > kmeans gives an error of "data failed conversion of points to tensorset.

Like advised by David here a version, without random seed, in C#, without datatree as Input. It seems to work well but I had not tested it a lot. It gives the same result as the VB component.

Hi guys! @laurent_delrieu Great job with rewriting the code to c#. I have a problem I struggle few days. Maybe you have some hints

I would like to cluster the points but in clusters of predefinded number of members.

Lets say I have a group of 100 points and with K-means I want to cluster them in 5 chunks of 20, 10, 15, 5 and 50 elements. And I have no idea how to do it…

how can I be sure in your code, that I have always the same number of items in all the groups? Actually, in my case it doesn’t matter how many group I have, but I have to be sure that I have always same number of item in the groups. Can you advise me here?