Our ability to see patterns is what makes us human. However we also see patterns where none exist because our brains are biased towards detecting certain kinds of patterns over others (e.g. faces). Create a pattern by making something with a lot of repetition. Is the resulting pattern easy to see or hard to see? What would it mean to create the illusion of pattern? Can you predict what the pattern will be when you run your code or does it surprise you?

Ideation

I thought about creating a grid with variables so that each grid would vary, perhaps based on some sort of randomness. Then an idea struck me — could it be a tomato grid? The shape, size, color, and vine position could all change based on some logic. Even better, if they can all fit tightly, or if they can animate.

I love tomatoes.

IMG_2725.heic

The first tomato

But first, I need to draw out one tomato, and the calyx (I learned the name just now). The calyx has repetition in itself already.

The vertices of the calyx sit on two ellipses, the size of which can be defined by r1 and r2. I started with 5 sepals (again, just learned what it’s called…). Honestly I wasn’t 100% sure about the calculation and half-blindly threw the value into code just to see what it’s like.

IMG_2726.HEIC

I used beginShape() and endShape() functions to draw the shape with vertices of each sepal. After each sepal, the radian is increased by TWO_PI / 5. The result is close, but not quite right. The inner vertex and outer vertex are at the same radian.

image.png

With a small tweak, I got a perfect star shape.

//outer vertex
starx = 100 + sin(a + PI/5) * 50;
stary = 100 + cos(a + PI/5) * 50;
vertex(starx, stary);

image.png

Tomato function (farm)

Sneak peaking into next week’s functions, I’m going to create a function to draw tomatoes, so that I can easily change the parameters for shape, size and colors. I moved all the code to a tomato function, and swapped out values with function parameters. Now I can easily manipulate the shape!

image.png