# Day 3: Foldables and Loops

Welcome to day 3 of our fabrication summer camp. So far we've been making flat objects. Today we break out of the flat plane into the third dimension. In order to cut these objects with our tools, they must start out flat. But the objects can be folded and assembled into higher-dimensional shapes.

## Scoring

Normally our vinyl cutter cuts. A foldable shape will have some cuts, but it will also need creases, which aren't cut. The cleaner we make those creases, the cleaner our folds will be. Paper artists make clean creases by gently dragging a knife along the paper in a process called *scoring*. Our vinyl cutter has a scoring mode.

Let's try folding a rectangular strip into a square spiral. We start with a wide rectangle. This rectangle must be cut from the paper, not creased. I trace it in a black stroke:

Now I want to make a red line wherever a crease should appear. Here's how I add one:

But I want a lot of them. I could copy and paste, but that will require a lot of fiddling to get the x-coordinates right. Instead, I can use a `repeat`

loop. Here's how I add 36 lines:

There are 36 lines, but they're all in one big pile. I need to spread out their x-coordinates, which I can do with a variable that grows:

To make this spiral, the gap needs to get bigger after every fold. There are several ways I might do this. One way is to introduce a `gap`

variable that grows:

I'll cut this from thick paper called cardstock and fold it into our spiral. Someday maybe we'll turn it into an earring.

### Practice Exercise

Your task is to make an accordion fold on a rectangular strip, which we will fold into a flower. Alternate between red and blue lines, like this:

We'll score the red lines on one side of the paper, and the blue on the other. These alternating folds are sometimes called mountain and valley folds.

We won't complete an open-ended design exercise this time. Coming up with your own foldable takes a lot of time!

## Nets

A flat shape that folds into a solid and closed 3D shape is called a *geometric net*. Designing a net is a good mental challenge that requires a lot of reverse thinking. You start by envisioning the 3D shape and unfold it in your mind.

Picture a tetrahedron, which is the simplest shape that occupies all three dimensions. It is made of four equilateral triangles. There are several ways to unfold one so that it lies flat. Consider this method:

- Set the tetrahedron so it's resting flat on a table.
- Peel one of the side triangles down so it lies flat.
- Peel one of the remaining side triangles down so it lies flat.
- Peel the last side triangle down so it lies flat.

What shape do the flattened triangles form? A bigger equilateral triangle.

We can make this shape in Twoville as a polygon with a bit of turtle geometry:

We put red lines on the internal creases. These lines form an equilateral triangle, which we can make with turtle geometry:

Suppose we cut this flat and assembled it into a solid tetrahedron again. The triangles would not stick to each other. We could attach them with tape, but visible tape is inelegant. To attach them invisibly, we want to add tabs along the edges that fold under a neighboring triangle. With a little glue, these tabs will hold the tetrahedron together.

In Twoville, we add tabs by inserting a `tab`

command right before a command that makes a straight line. Here we add a tab to the first triangle along each edge:

The tabs also need score lines. We add new segments to our path by tracing along the outer edge again. However, this time we use `fly`

to skip over the triangle that doesn't have a tab:

When we cut this out, we end up with a tetrahedron that almost makes itself. We just apply a little glue.

### Practice Exercise: Box

Now it's your turn design a net that folds into a box. A box has six sides: four walls on the side, one on the top, and one on the bottom. Here's one possible unfolding with the four walls on the side in a long strip:

Draw your unfolded box on your graph paper. Label the coordinates of all the faces' corners. Mark the edges where you would like tabs to appear. Not all of them need tabs; you will need to fold this mentally to identify the ones that do.

Have your drawing checked by a teacher. After any issues are resolved, head to the computer and code it up. Add score lines between the faces and along the tabs in red. Then we'll cut it.