I assumed that the first panel id in that array represents the topmost panel in the respective slice, but it looks like it's not. Is it related to rotation? I didn't understand that part very well, but nevertheless, the "layoutData->globalOrientation" is "0" so it shouldn't influence it, right?
They are not sorted in any specific order. You can assume it to be random.
They can be sorted in whichever way you require within the frame slice itself
So how can I know which one is the topmost one?
What do you mean by the topmost panel?
For example, having a configuration like in the Fig 1 from the docs (https://forum.nanoleaf.me/assets/sdk-images/fig1.png), I'd like a way to find out that "48" is the id of the topmost panel in the slice "3", and that "57" is the id of the second panel from the top, and "61" the third.
That should be fairly simple.
Once you get the layout, you could do the following steps:
- Rotate the layout by the rotation specified in LayoutData::globalOrientation
- Get the frameSlices
- sort the panels in the 3rd frame slice with the sorting key as the y position of the centroid of the triangles. You could use std::sort and provide a comparator function that takes in the two ids of the panels being compared, looks up the value of the Y position of the centroid of the two triangles and sorts according to that.
Hope this helps
Regards
Is there another way to get the centroid except iterating over the "panels" array of the "layoutData", getting the "shape" of each panel and then the "centroid" of each shape?