What is the order of the panel ids inside a frame slice?

Started by Revolt
36aa30c35850306ec239daad4923fbab?s=128&d=mm

Revolt

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?

C39416f4bdabbd5010f596095fb24348?s=128&d=mm

Aliakbar Eski

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

36aa30c35850306ec239daad4923fbab?s=128&d=mm

Revolt

So how can I know which one is the topmost one?

D82f51c8f6028e0c3681d1e83dc4c3d4?s=128&d=mm

Rowak

What do you mean by the topmost panel?

36aa30c35850306ec239daad4923fbab?s=128&d=mm

Revolt

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.

C39416f4bdabbd5010f596095fb24348?s=128&d=mm

Aliakbar Eski

That should be fairly simple.

Once you get the layout, you could do the following steps:

  1. Rotate the layout by the rotation specified in LayoutData::globalOrientation
  2. Get the frameSlices
  3. 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

36aa30c35850306ec239daad4923fbab?s=128&d=mm

Revolt

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?