# Largest Brep in Brep

Hi i have a problem with a very simple logic so i didnt attach any files because they wont be much use.

I have created a simple voronoi in a cube, which results in non orthogonal cells, how do i create the largest orthogonal breps in those cells?

You want everyone to recreate their own GH interpretation of your “very simple logic”?

Make it simpler and give us that logic as a GH file, not just a screen shot?

1.gh (6.9 KB)
1.3dm (2.6 MB)

Hi thanks for the suggestion, i hope this helps

Create or find?

You can measure the volume of each cell, which gives you a list of numbers. You then sort these numbers (they’ll be organised from smallest to largest), while sorting your breps synchronously. That means plug your numbers into the [K] input of the Sort component and your breps into the [A] input. Finally you can use the List Item component to get small or big breps. Index=0 is the smallest, Index=1 is the second smallest, Index=-1 is the largest, Index=-2 is the penultimate brep, etc. etc.

in that case how am i able to create the largest possible box inside each voronoi cell?

There is no easy solution to that, especially if you allow boxes to be oriented in whichever way. Computing the axis-aligned outer bounds of a voronoi cell is trivial because each min/max extent is independent of the others, however for interior boxes all three axes will change together.

Ah i see, would it be somewhat possible if i limit the inner largest box only to the xy axis?