# Divide voronoi panel along cell boundaries

I want to divide a Voronoi panel into two smaller panels (roughly halves) with the division running along the cell boundaries in zig-zag fashion. This will be such that when the panels are moved apart there will not be a straight line division.

I can separate out the populated points to each half panel, but am stalled when it comes to separating the cells to left and right halves.

Attached is my definition effort and also a manually generated Rhino drawing of what I am trying to achieve.

voronoi gates 1.0.gh (17.9 KB)
Voronoi gates 1.0.3dm (205.9 KB)
Voronoi panel split 1.8.3dm (60.6 KB)

Thanks in advance for any help on thisâ€¦

This problem seems simple at first, but it turns out to be quite challenging. To move the cells apart is not so hard - in fact, we do not need to separate the two halves at all! We simply find whether each point (in Voronoi, each point corresponds to its cell) is to the left or right of center, and move it farther in that direction by setting the amplitude of a vector. (see attached definition). It is nice not to have to separate, because this allows us to keep our tree structures a little simpler later on.

The remainder is a little more involvedâ€¦ getting the break-edges reliably for all possible break geometry is not so simple! Fortunately we can use the Delaunay triangulation, since it is the mathematical inverse of the Voronoi pattern - this gives us an analysis of which cells are adjacent to each other, and then we can test adjacent cells for if theyâ€™ve moved apart or not. If they have, we then find the edges that are along the break-line. If they havenâ€™t, then they are not on the break point and we donâ€™t need to worry. The implementation in the attached definition accomplishes this (I think). If youâ€™re interested, I can go through the details and explain why things are done a certain way in GH - sometimes the way you need to do things isnâ€™t always straightforward.

As a finishing touch in order to replicate your Rhino version, I took the liberty of trimming the outer rectangles in the grasshopper model with the break line curves. Also, there is included a slider â€śCull Distance to Edgeâ€ť that adds or removes cell outlines near the break, like youâ€™ve shown in your Rhino model. You can try out different configurations of Voronoi cells by playing with the seed slider!

Let me know if this works for you, or if you have any questions! Happy to help.

Best,
Dan

voronoi gates 1.0 updated.gh (44.2 KB)

(P.S. - the outline might be a bit weird if the panels are too close together. This is a problem in the last bit of the script. If youâ€™re fabricating, probably best to bake it out and do them separately at a good distance)

2 Likes

Dan,

Thanks ever so much for your definition, itâ€™s perfect!

Iâ€™d made a little progress myself and got as far as splitting the cells using a very clunky method, but had not managed the central division.

Your definition uses Grasshopper components Iâ€™ve not seen or used before and itâ€™s going to take me some time to figure out how it works, probably need to take you up on your offer of an explanation on some points.

Not sure where you are but let me know if you want some gates!

Thanks again,
Charles.