Largest Brep in Brep


(Jonathan) #1

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?

(Jonathan) #3 (6.9 KB)
1.3dm (2.6 MB)

Hi thanks for the suggestion, i hope this helps

(David Rutten) #4

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.

(Jonathan) #5

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

(David Rutten) #6

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.

(Jonathan) #7

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

Thanks for your help!

(David Rutten) #8

As this discussion seem to imply, it’s non-trivial even in the 2D case.

If you limit your search to world-axis-aligned boxes only it will be a smaller search space, but it will still be difficult. In fact I’m having a hard time even imagining an algorithm for this that isn’t embarrassingly brute-force, let alone implement it.

(Jonathan) #9

alright thanks, that was an interesting read. thanks for your help!

(Jonathan) #10

Hi just a follow up question, if i have now divided each voronoi cell’s bounding box into 4x4x4 boxes, and subsequently, solid intersection these 64 boxes with the voronoi cells. How do i form a cull pattern to only keep those boxes that are of equal volume. like trying to pixelate the voronoi cells? (31.6 KB)
2.3dm (2.7 MB)