I have to import boxes with differents size and arrange them in a quadrant so that the larger ones are on one corner and the smaller ones on the opposite corner.

to make myself more understandable, here is a picture of where I have arrived until now

what i need to do is to sort the boxes by angles and not by lines or rows

Any reference picture of the result?

So this question is not about three.js specifically, but about sorting in general.

well actually it could be, do you have an idea anyway?

Will it always have 3 β0β, 3 β1β, 4 β2β, 5 β3β, 4 β4β, 3 β5β and 3 β6β ?

thanks for the answers, by the way,

it was just an example the boxes are created randomly, for example with a height value from 0 to 20. I should find a way to always allocate them in the right position. From the largest to the smallest, or vice versa, in order not by lines or rows on the dial, but more by radians.

So, basically, you want it in this order?

YES! exactly like this

/cc

First, put bars in an array and sort it by heights of bars.

Second, find an algorithm that puts elements of an array in the desired order.

Well, with help of `.sort()`

of array and this SO answer: https://stackoverflow.com/q/35373936/4045502

Iβve turned this

into this

Wow! thatβs exactly what I meant.

thanks a lot

Youβre welcome

Iβve added a link in my previous post