FINAL TUTORIAL – EXPLORING VORONOI



Author:

Categories: Tutorials

Tagged with: | | | |


E X P L O R I N G  V O R O N O I

In my attempt of using Voronoi for my project, I have discovered 2 ways to Voronoi surfaces.

Method 1:

This method is more beginner-friendly and is also the one I started out with. My initial intention was to create a candle holder using Voronoi for its ability to produce cells of varying shapes and sizes. When lighted, this would create a lovely effect with the different shadows.

  1. Create the surface for which you which to apply Voronoi. In my case, I wanted a hexagonal base with radius 100mm. I set the height of the polygon to be 200mm using the Move function before lofting the curves with the Loft feature.
  2. Taking the dimensions of the surface that was produced from lofting to create a plane surface, I used Populate 2D to populate the surface with points. These points are then used for the Voronoi to create cells.
    1
    2
  1. The attractors act like magnets that help to attract or repel objects so cells near the attractors are scaled smaller. Scale the original cells from Voronoi. This works like Offset Curve, but without all the problems such as broken curves or no curves.
    3
    4
  2. Graft the curves produced using Scale to obtain lists with only one item. Then, flatten them to get one surface. This grafting and flattening helps to change the data structure within the parameter. Panel can be used to see the differences in the way the data is structured with and without grafting.

5With grafting and flattening

6
Without grafting and flattening

  1. The surface is then extruded before morphing with the original surface produced for the Voronoi using Surface Morph.
  2. Create a base for the candle holder by extruding the base from Step 1. Do the same to create a stage for the candle.Here is my final product:

7

 

Method 2: (with credits to Simon)

This method is more general and makes use of Text Distance to get rid of unwanted seams.

  1. Create the surface which you wish to apply Voronoi.
  2. Populate the surface with points and use Voronoi to get the cells. Unlike method 1 where morphing was used, Voronoi is directly applied to the surface in method 2. The initial surface is split into individual surfaces using Split Brep Multiple and then deconstructed.
    8
  3. List length is used to check the number of items in each list. The data is then put through Larger Than with the B set as 1 to sieve out the surfaces which have more than one item in their list (i.e. the surfaces which have the seam in them).
    11
    9
    10
    Cells with seam running through
  1. The surfaces are deconstructed into curves. From the panel, we see that most of them are Planar Curves while a few of them are Line-like Curves. The Line-like curves are the seams that we wish to remove so we input the text in a Panel at B. Text Distance measures the ASCII distance for every letter. If the texts are identical, Text Distance is 0. This data is passed through the Gate NOT so that the Line-like curves are removed (and not the other curves). The remaining curves which are touching are joined to form Closed Curves.
    14
    12

Cells after culling

13

  1. The data from the list in step 3 is put into Clean Tree to remove null values and lists with items in them. This data is then used as Masks in Split Tree to sieve out the specific branches from the initial deconstructed faces of the surface and the curves obtained from Step 4 before merging the data.
    15
  2. Discontinuity is used to find any discontinuities in the curve before connecting them with Polyline to get smooth curves.
    16
  3. The cells are then scaled to varying degrees based on the length of the curves before being merged with the unscaled curves.
    1817
  4. Loft the result from step 7 and create a mesh.
    19

 

Final product:

20

If the script does not work for you, try setting the absolute tolerance to 0.01 under Unit Settings.

Method 1 is definitely easier to understand and execute for someone who is completely new to Grasshopper (like me!) but it can only be used on surfaces with 4 edges. Method 2 is more general and can be used for more types of surfaces even though it might be more difficult to understand. It also uses a very cool Text Distance technique to “fish out” data.

Remember: Don’t use Offset Curve for Voronoi!

Voronoi on polygon (.3dm)

Voronoi on polygon (.gh)

Voronoi on cylinder without the start-end seam_SP08 from Simon (.gh)