From the course: Grasshopper Essential Training (2017)

Hexagonal tiling introduction

From the course: Grasshopper Essential Training (2017)

Start my 1-month free trial

Hexagonal tiling introduction

- [Instructor] In this chapter, our goal is to set up a parametric hexagonal tiling pattern where we can control the number of rows and columns of shapes that we're generating, as well as the size of those shapes and the distance between them. In later videos, we'll use that same algorithm to bring in 3D hexagonal tiles and arrange them in space. In this video, I'd like to just give some background on hexagonal tiling systems and go over some of the math that we'll need to get our algorithm up and running. So in Rhino, I've opened the file hex-tiling.3dm and in Grasshopper, I've opened the file 0020hexagonaltiling.gh, and that's in the folder 0060. So in Rhino, I'm just going to for demonstration's sake bring up the polygon command. So I'm just typing in Polygon into the Command line and with gridsnap on, going to set the center of my polygon at zero and let's make a corner at 20. Okay, and I'll set that right on the X axis. I'll make sure that I'm doing 6 for my number of sides, since I'm drawing a hexagon. Again, that corner's at 20. So when we're thinking about the way that hexagons tile together, it's different than something like a checkerboard. They don't just butt up against each other perfectly. And if we turn on the Hex Tile Diagram layer, we can see an example of that. So notice that the hexagons stack vertically right on top of each other. But horizontally, they're a little bit offset. So if I go up the list here, they just sit right on top of each other. But their neighbors are either a little bit higher or a little bit lower. So we need to take that into account when we're trying to make a parametric tiling pattern. And I have here in Grasshopper basically an overview of the algorithm that I'll need to set up to get this to work. So first of all, I need to Calculate the Horizontal Offset and the Vertical Offset of my tiling pattern. I'll need to get the Column X and Column Y Coordinates of each base of that tiling pattern. And I'll need to get all combinations of those X and Y coordinates. So basically, these three steps are generating the grid, or the offset grid, that's going to line up all of my hexagons. Then, with those values, I'll offset every other column vertically, so bumping those up so that they can tile correctly. And then finally drawing the hexagons. So the trickiest part to getting this to work is getting the offsets correct. And that goes for the vertical and the horizontal offsets as well. But luckily, there's some basic math we can use to get us there. And we can see some examples of that in the Hex Tile Dimensions layer, so let's turn that on. I'll just zoom in a little bit here. So most importantly, we have the radius of our hexagon, and we'll call that R. And R is going to be the same in every corner of the shape going out from the center point. But it's not quite the same at the top and the bottom. So to help us get the height of the shape, we need to pull in a little trigonometry to first figure out the angle measurement of each corner. So we know that each angle of the hexagon is 120 degrees. We know that cause there's a basic formula. That's 180 times the number of sides minus 360 divided by the number of sides. So if we're doing that for a hexagon, that would give us 180 x 6 - 360 or 720 total and then we divide that by 6, the number of sides, giving us 120 degrees per angle. From there, we can get this outside angle of 30 degrees. Again, just a little trigonometry. We know that this interior angle is 120. So that means that these two angles are 60 each because this whole span is 180. And since this is a regular shape, we can divide those in two giving us 30 degrees for that angle between the corner and the vertical here. So 30 degrees is really the key piece of information here, because that's what we'll use to calculate the distance for our vertical offset. And we'll get that by multiplying our radius, R, by the cosine of 30. So that tells us how far we need to offset every other column and twice that gives us how far apart each hexagon is from the one below it. And last but not least, we have our horizontal offsets. So that's the distance from the center of one hexagon to the center of its neighbor. Now you might think this would just be two times the radius, but it's actually one and a half times the radius. And again, that's because of the way we have to vertically offset these shapes to get them to perfectly fit together. So now that we know some of those properties, in the next video we'll plug those into our algorithm and get a dynamic parametric hexagonal tiling system set up.

Contents