sorry for the strange and unclear title of the topic, I hope someone can help me.

For work, I often design theaters or auditoriums.
For some analysis, I insert the seats references as “Points”.
I would need that the index of the seats (point list) are to have a homogeneously numbering, but if I insert the reference points of the seats, I have a staggered numbering.

I think it is not possible, but would there be the possibility of having a correct numbering, starting from the first row, perhaps from one of the side seats??

There might be a mathematical way to do it using polar coordinates and some modulo function, but before diving into that, can you create a single spiral curve and order the points along it? This curve is just drawn in Rhino for the time being, but no reason not to try and automate this process in gh. Then you can just order them along the curve (first 100 or so points shown):

Otherwise due to the nature of this particular geometry set on radial arcs, you can just take the distance to a point just slightly offset from the arc centre, and that sorts the points just fine (apart from the back two straight rows of course).

I think this solution leaves him where he originally started. He wants every row to start with 1, not wrap around. You would need to split the points list based on the amount of seats in each row, and I think the fastest way to do that would be to manually enter that list, so like 17,17,18,18,19 as the rows get wider, etc.

Something like this might work, but you can see how it’s a little time consuming to manually enter each row in the list, and how it starts to break down a bit. So definitely not perfect.

Ah I see! Thanks, I missed that! It doesn’t quite leave him where he started as the list of points is jumbled in places, but I get the point.

You can cluster up the points by looking at the distances as you move along the sorted list and group accordingly, basically jumping to the next group when the distance reaches a threshold (controlled by a certain tolerance). It doesn’t work for the end rows of course though, might have to use a different reference point to sort those, but for the arcs seems to be ok.

This is a lot of trouble and doesn’t attempt to number the balcony seats. It would be much easier if GH were used to create the points in the first place, in which case (ideally) they would already be in order?

Numbering starts at the stage-left end of each row.

This version ignores the balcony seats (purple group) so avoids the corrupted numbering on the last row. And it reverses the list of points from CrvNear ‘B’ so numbering restarts stage-right in each row.

1 - finding second closest point to form a first set of lines (neighbour seat on same row)
2 - joining all lines into polylines
3 - Method: extend all polylines both end by 0.5 of average neighbor line fount on pt 1, find closest pairs
4 - make lines with original points (not extended), join all
5 - Method again, but with 1.5 factor to fill corridor between same row > lines > join again
6 - sort polylines

SeatsNumbering.gh (41.5 KB)
My attempt … > wrong use of grasshopper.

I mean, manually “feeding” pseudo ordered data would let you use a much simpler gh definition than what i just made. My definition is too complex for this small problem.

Or, yes, if this sorting-seats problem happens very frequently, go for a complex algorithm…

At first, I did a version of this exclusively for the balcony seats, using their Z values to separate one row from another before sorting by their Y value… Then the light bulb went on - I could do this for all rows!! (white group)MIndex to the rescue (link), except for one very bad point that had a spurious Z value, repaired in the yellow group.