Category Archives: javascript

Drawing Parameterized Objects: Bottles

Each year, my wife and I try to go to Japan to visit her mother. We didn’t make it last year, but the previous year we spent a couple of weeks there and took a several day trip to Kouyasan and Nara City. I loved Nara – probably my favorite place in Japan so far. In the elevator of the hotel we stayed at were advertisements for the hotel restaurant and bar, like you’d see in any hotel elevator. The one for the bar had a hand-drawn  illustration of  a bunch of bottles on shelves.  I really liked the look of it and thought it would be a great to recreate as a generative art piece. I played around with a bit at the time, but never published anything on it.

Basically, each bottle is an object. No two bottles are exactly the same, but you can say that all bottles have more or less the same properties. To start with, I made this sketch:

bottles_01

 

1. To start with, each bottle has a width and a height. We can represent that as a simple rectangle as in the first image on the left.

2. Within that rectangle, we can say that all bottles have the same requisite parts: a body, a neck and the part where the cork or cap goes, which is called the finish. We can represent each of these as rectangles as well, as in the second image. Most bottles also have some sort of label too, so we’ll throw that in there.

3. Bottles rarely have sharp edges. They are rounded on the bottom and at each point where one part of the bottle morphs into the next part. The round part at the bottom is called the heel and the rounded sloping part between the body and neck is called the shoulder. The finish is also rounded and can have some more complex shapes involved, but we can abstract that much away. The label’s shape could be a strict rectangle, a rounded rectangle or an oval and could be rotated so you see the front of it or some lesser portion.

All of these parts can be parameterized and randomized. In addition to the base width and height, the body could take up anywhere from half to most of the height of the bottle. The neck’s width could be defined as a percentage of the width of the body, so could be relatively wide or thin. The heel could be squarish or very round, The shoulder could be rather straight or very gradually sloped. The neck could also be long or short and the finish could be a lot or just a bit wider than the neck, short, tall, very rounded or more squared.

Assigning parameters to all of these variables and then randomizing them will give you a nearly infinite variety of bottles. And we haven’t even gotten into color yet. I’ll be posting images at each stage of development of this. I may post some snippets of drawing code as well, but not the whole project’s code, sorry.