1.2.06. Sort


Date published: August 9, 2022


Sometimes data is stored in a predictable (sorted) fashion, sometimes it is chaotic (unsorted). The Sort component allows you to sort multiple sets of data simultaneously, though this example only sorts 2 sets at the same time. Points by themselves cannot be sorted, but numbers can. This example sorts an unsorted set of points by creating a new list of distance values which acts as the key list. As the key list is sorted, the points are automatically shuffled in the same fashion.  


1.Create a point grid of parametrically defined size and density  
2.Generate a circle around it and pick a point on this circle using a slider (reparameterise the curve first so evaluated point-coordinates fall between values 0 and 1)  
3.Calculate the distance from this point to each point of the grid  
4.Sort the point list (a) acc. To the key list (k), which is the distance of each point to the evaluated circle point  
5.Draw a polyline through the sorted point list and join it with a line that connects the evaluated circle point with the closest grid-point i.e., the first one in the list 

This exercise is using Grasshopper version 1.0.0007 

References:  Grasshopper Tutorials (2015), wiki.mcneel.com/labs/explicithistory/examples, Accessed 12/07/2022.




course files


745.91 KB | 924 downloads