# Sorting question

Hello
I’m trying to sort and cull a list of regions in such a way that I get a checkerboard pattern in the end.
I’ve tried getting the centroids and using the radial sort component, but I don’t get what I need… I’ve also tried an arithmetic sorting by deconstructing the centroid points, again without getting the required result.
Any help would be greatly appreciated!

original file with unnecessary component fluff…
subdivisions023.gh (19.3 KB)
simplified version:
subdivisions023b.gh (11.2 KB)

FYI, for anyone else who wants to try this one:

2 Likes

I guess it would be better to just explain the logic behind the construction:

1. construct an arc (half circle) and the corresponding chord (diameter in this case)
2. divide the arc in n parts
3. connect the division points with the chord end points.
4. get the rectangular and triangular regions

It would be even better to post a simple model that doesn’t require plugins. ‘Line MidPt’ sounds like Point On Curve, a standard GH component.

(the Crv param is there only to hide the plane preview from Arc)

1 Like

You are right Joseph. I’ve added a clean version

I didn’t wait. No plugins required.

arc_fan_2019Aug9a.gh (16.5 KB)

Algorithms + Data Structures = Programs
Niklaus Wirth, 1976 book

1 Like

Thank you for taking the time and for the link!

How we view a problem makes all the difference. Algorithms can radically change the nature (and performance) of a solution. Like sorting, for example.

Saw this video yesterday:

2 Likes

Thanks again for your guidance Joseph. I am subscribed to 3b1b’s channel and I love his stuff even though it is, at times, above my maths expertise. I’ll def check the video out!