Grouping Points Based on Proximity on a Surface in Grasshopper

hello

I have two sets of points, each containing 6 points. I want to group these points so that I can arrange them in clockwise or anticlockwise order for labeling.

my questions are

  1. How to group the points on the surface based on their proximity.
  2. How to determine the clockwise or anticlockwise order of the points in each group.
  3. how to Output the groups of points in a way that can be easily used for labeling.

grouping the points.3dm (77.8 KB)
points group doubt.gh (18.3 KB)

Any guidance or insights from the experienced users would be greatly appreciated.

  1. “Group” (in fact : Clustering). One way is the standard one: K-Means (Google that) as far as you know the N of Clusters. There’s also various other ways: for instance a more “generic” distances Clustering as far as you know the max prox distance.
  2. After defining a suitablle Coordinate System (say: a fitted Plane moved to the Cluster centdroid) AND “orienting” properly the Plane … one way is to order pts by Angle (of 2 Vectors: Plane XAxis and pt - Plane.Origin).
  3. Use some higher order data collection Type like a DataTree.

For the 2 see the 3 indicative snaps attached to my answer to this (for “orienting” Planes Dot/Cross (Google these) Products are used) :

I think there’s a component for pulling points to the nearest shape, and it should output the index of the shape which was nearest. So that’s either going to be a 0 or a 1 if you use two curves. You can then use that number to sift your points into two outputs.

I can’t check to make sure as my current build of Rhino crashes on startup. It’ll take a few hours to sort out.

The points are already separated into two groups; you just need to sort them.

points group doubt.gh (20.1 KB)

1 Like

Thank you, Seghier Khaled, for your insightful response. I have two additional questions regarding the grouping and arranging of points on a surface for labeling in Grasshopper

  1. What if I have a large number of main pieces, such as x1, x2, …, x30? How should I efficiently create the corresponding points for each main piece?

Question 2:

"2. What if I have an uneven distribution of points, with 14 points in x1 and only 10 points in x2? How should I handle this situation while maintaining the desired grouping and ordering?

Can you share an example?
Your points are grouped according to the logic of your script.
Another situation may require a different solution.

"I apologize for not providing a detailed example in my previous message. My primary concern is how to establish a consistent starting point for labeling each group of points, ensuring that the labeling follows a clockwise or anticlockwise direction. For instance, I want to ensure that the labeling for group x1 starts at point 1 and proceeds in a clockwise manner, and similarly for the remaining groups.

Secondly, I’m wondering if there’s a more efficient approach to automating the creation of text components for each group of points. Currently, I’m manually creating text components for every group, which becomes tedious as the number of groups increases. Is there a way to automate this process using Grasshopper’s native components or third-party add-ons?"


points group doubt (1).gh (39.5 KB)
grouping the points.3dm (148.2 KB)

Thank you

I made some changes to your script to ensure that all points are sorted. You can use the shift list and flip curve if you want to change the position of the letters or the direction.

points group doubt_2.gh (23.6 KB)

1 Like

“I’m so thankful for your brilliant advice and the helpful solutions you’ve shared so far. I tried my best to follow your instructions and apply the suggested methods, but I’ve faced a few hiccups along the way. I apologize for my persistent requests, but I’m eager to overcome these challenges and achieve the desired results. Your continued support and expertise would be immensely valuable to me.”

"With your continued guidance, I’m confident that I can overcome the remaining hurdles and achieve the desired outcome. Would you please kindly assist me in addressing my remaining questions

Question 1:

I’m interested in establishing a reference point, or origin point, for each piece, consistently positioning it either on the left or right side. It indicates where to begin the assembly process.

Question 2:

I want to create labels for each piece and its sub-pieces. Each piece should have two labels: one in the center of the whole piece and another in the center of each sub-piece. The label should also show the piece’s position in the sequence, like “X1” for the first whole piece and its sub-pieces.

Question 3:

In situations where a main piece, such as “X1,” splits into two separate main pieces, one on the left and one on the right, I’d like to differentiate them by labeling the left piece “X1-LA” and the right piece “X1-RA.” This approach would be consistently applied to all pieces, regardless of their position, ensuring clarity and organization.

Additional Request:

If the generated label extends beyond the boundaries of a piece, could it be automatically resized to fit within the piece? This would prevent label overlap and ensure that the labels remain visible and unobtrusive.

“I’m so thankful for your time and expertise. Your answers have been clear, concise, and incredibly helpful.”
points group doubt.gh (12.3 KB)
grouping the points.3dm (323.0 KB)

Dear Forum Members,

I hope this message finds you well.

I’m writing to follow up on my previous post regarding this problem.

I’m still facing difficulties with [problem description], and any insights or assistance you can provide would be greatly appreciated.

If you have any suggestions or recommendations, please let me know.

Thank you for your time and consideration.