·

Recursive Subdivision of a Topographical Surface – Example 8.3

This example is partly regional analysis, partly trying to make cool images, and partly could have some practical applications. I’ve seen a few scripts floating around called “Recursive Subdivision of a Surface.” One example is on the website of co-de-it a computational group from Italy (*note as of 2025 this website is defunct…will find a new link), where a surface is measured for its curvature, and after each round, if the curvature is still high, the surface is further subdivided into smaller pieces, and when not, the subdivision process stops. I decided to try the logic of this script out with some topographic surfaces to analyze slope and flatness in slightly new ways. Script function in detail For this first example, I decided to try the script on an area around the German town of Hannoversche Münden, a small village at the confluence of the Werra and Fulda rivers, where the Weser River is born. This isn’t important to know for the script, but you’ll probably get better results if you pick an area with some distinctive topography at least for your first area.


Birdseye view of Hannoversche Münden – Source: Google Earth

Getting Started in Rounds 1 and 2 – Divide Topography into Four Equal Parts

To get the topography, I used the “Elk” plugin for grasshopper which can analyze SRTM elevation data. If you want to know more about how to import topography please see this tutorial 20.2. The image above describes the first steps of the script. I am showing the contour lines only for reference in the first image, to get a sense of the kind of surface I am working on. The next two images show the result of two looping “rounds”. In each Round, the initial surface is divided into four smaller sections. So our initial single surface will be four surfaces after round 1, 16 after round 2, etc.

Example of Test at Each Round Testing Elevation Change over each sub-surface

After each division, the algorithm tests the four corners and the center point of each of the sub-regions for “flatness” If all five points (4 corners + center) have a similar elevation, say they are all within 10 meters of each other in “Z” value, the division process stops. The subsurface is then removed from the iterative division process by feeding it from the D0 loop into the D1 loop. If not, each sub-surface is further divided into four sub-sub surfaces in each round, and these are again tested, and further subdivided, until all four corner points and the center point have “Z” values (elevations) within the range of tolerance.

In the example above, I show one of the 16 sub-surfaces from Round 2, as well as the four corners. The highest point has an elevation of 300m, the lowest of 124m, with a 176m differential. This subsurface doesn’t come close to passing the flatness test! So it gets chopped into smaller pieces.

Rounds 3-8: Progressive Division of Terrain

Subsurface Division from Round 3 (top-left) to Round 8 (bottom-right)

The divisions continue as before as long as the subsurface is not sufficiently flat. The image above demonstrates this process further, where subsurfaces still eligible for division are shown in pink, and surfaces sufficiently flat are shown in yellow. By round 4, a small piece near the bottom right corner finally qualifies for removal from the division process, with the lowest elevation being 123m and the highest 130m, a 7m differential. This sub-surface is removed from the looping routine, and spared further subdivision.

The first sub-regions to pass the “flatness test” appearing in round 4 correspond roughly with the flood plain of the Fulda River in Hann. Münden. In round 5 and 6 the flood plains are largely out of the looping process, and the mountain tops are also qualifying for the flatness test as well (these are soft, rolling mountains). The last holdouts are the relatively steep intermediate slopes, but even these are flat enough by round 8. By round 9 the process is over.

Final Results

After the subdivisions stop, I am left with this “Quadtree” image as shown below and to the left. Flat and steep parts of the terrain should be clearly evident. I could stop here, but I decided to take it just a little further and to draw a circle in each square (bottom-center) and color these with a gradient (bottom-left).

Variations and Concluding Observations

That’s about it! Oh, one last thing. Sometimes the edges of a surface, may look a little funny. This has to do with the way a patch surface is created in Rhino. If this bothers you, you can trim the edges of your surface. Further Examples I tried this with a few other topographies I am familiar with as well. In some of these, topographical features become quite clear, while in others not so much. Generally “flat” sites generated more uneven results, since the five test points might fall in the range even though there is some topographic variation between them. but 100% accuracy is not the point of this script. One thing that’s interesting, the river valley in Rougemont (a small mountain village in the pre-Alps) has its biggest circles in the river valley, and collections of big circles are where the towns tend to be. In Hannover, on the other hand, the smallest circles are near the river. Maybe the topographic variation is so slight, its only in the flood plain that you get more than 5 meters of distance… In Bueren, which is near the head of the Leine river, the river plain is clear with large circles, as is an escarpment to the south. Anyways, here is an image of the script, showing the recursive subdivision process. Not shown is afterwards circles being draw at the center points with radius based on area, but you should be able to figure that one out…

Image of Overall Script

Comments

9 responses

  1. katie Avatar
  2. Ignacio Alcalde Avatar
    Ignacio Alcalde
  3. Shelly Drees Avatar
    Shelly Drees
    1. josclag Avatar
  4. Sebastián Zaror Abumohor Avatar
  5. Prachi Avatar
    Prachi
  6. Andrew Avatar
    1. josclag Avatar
      1. Andrew Avatar