Landforms created through Topological Analysis of Shapes – Example 4.7

04_08_V1

I wasn’t sure where to put this example exactly, since it came as a follow up to Example 8.4, but the general scripting is less complex so I decided to put it a bit earlier. The general problem and solution has many applications beyond topography as well, but for landscape architects, maybe its most ready application would be in the creation of landforms. It could also be used to generate generalized roof profiles for buildings in some cases.

If you already looked at Example 8.4, the recursive offsetting of base curves to create a topography, you may have tried a similar process going inward. Offsetting towards the exterior sometimes, but rarely causes problems with changes in topology, a mathematical term describing the form of a shape, but offsetting towards the inside is often a very different matter.  If you are offsetting contour lines for a landform, for example, which is somewhat irregular in form, you will probably get to a point eventually where the landform “splits” into separate contour lines, or separate “peaks”. If you have an automated process in grasshopper, similar to Example 8.4 for example, going towards the inside, this can create problems.

Fortunately, there is a fairly simple solution for describing the topology of a shape through what is called the “medial axis,” and using this description in turn to create a landform out of any arbitrary closed shape or closed set of shapes. The logic of this script using Voronoi cells to find the “medial axis” is explained on the Space Symmetry Syntax blog by Daniel Piker, but here the definition is reworked to work with the latest versions of grasshopper, and also extended a bit at the end. This definition is designed to work with any number of input curves, but you will have to pay attention to the data structure, particularly the “Grafted” elements throughout for it to work properly.

Step One – Use Voronoi Cells to describe typology of shape

04_08_step01

The script starts here with three arbitrary curves, in this case boomerangs. These curves are divided into a regular number of points, and these division points in turn are used to create a Voronoi diagram. If you look at the diagram, the boundary between the cells corresponds closely to the elements that can be described as the “Ridge” and “Hips” of our landform. You will have to increase the number of curve division points to make this line increasingly more precise, while not overwhelming your computer. Finally, we use the “Trim Region” command to trim the Voronoi cells, and we will only go forward with the pieces of geometry that are inside our region curves.

Step Two – Extract Medial Axis and “Veins” from Voronoi cells 

04_08_step02

Once we have the cells inside our shapes, we can explode the cells. We now divide the remaining geometry into two classes. The pieces of geometry which touch the edge curve always run perpendicular to the slope of our landforms, and we will call these “veins” (like veins on a leaf) going forward. The pieces which do not touch the edges comprise the topological skeleton of our shape. To separate these, we will use the “Collision One” component to return a true/False value for our shapes to see if they touch the outside edge curve. These two sets of Geometry are then dispatched.

Notice also what I did with the data structure. I used the “Trim Tree” component to remove all levels of data structure except for the last one. This is because I don’t care what cell the lines used to be associated with, but I still do care which of the three starting lines each line is associated with. If I flatten all the way, it will not work properly.

Step Three – Move Topological skeleton vertically to define landform

04_08_step03

In the next steps, I will use the geometry I generated to develop a landform and a mesh. I can use either the medial axis to define this mesh, or I could use the veins. In the image above, I use the veins. In the image below, I use the Medial Axis.

04_08_step03BThe general principle in both is the same. The endpoints of each piece of geometry are extracted, and then moved vertically based on their distance from the edge curve. The amount of movement is scalable based on the desired overall slope. Once these points are moved, the lines can be redrawn.

Step Four – Create Mesh and Contour Lines

04_08_step04A

Here I am using the endpoints of each of the “veins” to define a mesh, from which I will derive contour lines.

Step Five – Optional Lofts for the Veins

04_08_step04BYou could also draw some geometry with the veins, but this is a totally optional step.

Variations

This definition should* work with any number of closed shapes of any size and form. You will only need to adjust the number of initial curve divisions to get results that are more or less precise. You can also adjust the height scaling factor to get various landform slopes. Below are just two examples of possiblities, based on a complex, curvilinear form, and one based on simpler triangular shapes. Note it works well in both cases!

04_08_Variation

Advertisements