A New Tile-Based Method for Constructing Single-Line Drawings

Year: 2023 Authors: Robert Bosch; Izzy Snyder

Core claim

A fixed set of eight tiles, combined with optimization models, can generate single-line drawings that are both easily traced and visually faithful to low-resolution targets.

Topics

single-line drawings, tile-based construction, optimization models, Eulerian graphs

Domains

graph theory, Eulerian paths, integer optimization, combinatorial design, optical art, visual design, mosaic art, posterization

Methods

binary decision variables, constraint optimization, Gurobi, error terms

Media

decorated square tiles, rectangular board, grayscale target images, line drawings

Paper text

The text below is the locally extracted OCR/Markdown version of the paper. Raw PDF files remain local and are not published here.

Bridges 2023 Conference Proceedings

A New Tile-Based Method for Constructing Single-Line Drawings

Robert Bosch and Izzy Snyder

Oberlin College, Oberlin, Ohio, USA; rbosch@oberlin.edu, isnydr@oberlin.edu

Abstract

We present a new tile-based method for constructing single-line drawings. Our method involves positioning decorated square tiles on a rectangular board. We use a set of eight tiles. Each one has a light beige background, and seven of the eight are adorned with black line segments that connect one or more midpoints of certain sides of the tile to one or more midpoints of other sides. When we place copies of these tiles on the board, we follow one rule: we must arrange them in such a way that their black line segments join together to form a single line that enters the board on the left and leaves it on the right. Our goal is to construct a single line that can be easily traced by hand or eye when viewed from up close yet also resembles a recognizable target image when viewed from a distance.

Introduction

We present a new tile-based method for constructing single-line drawings. Our method involves positioning decorated square tiles on a rectangular board. We use the set of eight tiles shown in Figure 1.

img-0.jpeg Figure 1: The eight tiles.

Each of these tiles has a light beige background, and seven of the eight are adorned with black line segments that connect one or more midpoints of certain sides of the tile to one or more midpoints of other sides. When we place copies of these tiles on the board, we follow one rule: we must arrange them in such a way that their black line segments join together to form a single line that enters the board on the left and leaves it on the right. Our goal is to construct a single line that can be easily traced by hand or eye when viewed from up close yet also resembles a recognizable target image when viewed from a distance.

Figure 2 displays an example. The top left subfigure is a low-resolution target image, and the top right subfigure is an easily-traced single-line approximation of this target image. To understand what we mean by “easily traced,” it is helpful to think of the single-line drawing as a map of the streets in some neighborhood of some city and to imagine that a school bus driver wants to enter the neighborhood at the midpoint of its western border (the midpoint of the left edge of the map), traverse each street segment in order to drop off the children who live there, and ultimately exit the neighborhood from the midpoint of its eastern border (the midpoint of the right edge of the map). To minimize distance traveled, the driver wants to traverse each street segment exactly once. And to allow themselves to focus entirely on the safety of the children, the driver wants to be able to drive through the neighborhood without giving any thought to where they’ll turn left and where they’ll turn right.

Bosch and Snyder

img-1.jpeg

img-2.jpeg

img-3.jpeg Figure 2: (top left) A target image, (top right) an easily-traced single-line rendition, (bottom left) the associated Eulerian graph, and (bottom right) an interlaced rendition of the single-line drawing.

img-4.jpeg

Consider the graph displayed in the bottom left subfigure of Figure 2. We constructed this graph by replacing each nonblank tile with a vertex and also introducing both a “start vertex” and an “end vertex.” The edges connect the vertices in a way that is consistent with the way in which the street segments are connected in the map. A quick glance at this graph reveals that it is Eulerian: it is a connected graph, and all of its vertices—other than its start vertex and end vertex—have even degree. It therefore can be traced: one can find a route from the start vertex to the end vertex that uses each edge exactly once. In fact, there are many such routes. One of them is displayed in the bottom right subfigure of Figure 2, in which we drew the line so that it passes under and over itself. This interlaced rendition proves that both the graph and the line drawing can be easily traced: the driver need not spend any time worrying about where they’ll turn left and where they’ll turn right. Each time they come to an intersection (a copy of tile 7), they can and should drive straight through the intersection, provided that it is safe to do so. By following this simple rule, they will make sure that they will traverse each street segment exactly once.

Our inspirations for this project include Bosch’s extended-Smith-tile and knot-tile mosaics [1], the “linear idea” designs of Waclaw Szpakowski [4], and the “Right-Angle Doodling Machine” of Clive Thompson [5]. In the next section of this paper, we will present the mathematical optimization models we use to create our easily-traced tile-based single-line drawings. In the final section, we will share some additional drawings.

Optimization Models for Designing Tile-Based Single-Line Drawings

All of our models use the same data, the same variables, and the same constraints. They only differ in the objective functions they use.

Data

Most of our data describes our grayscale target image. We let denote the brightness value of the image’s row--column- pixel, using a 0-to-100 scale in which 0 denotes black, 100 denotes white, and the remaining integer values represent various shades of gray. In the target image displayed in Figure 2, each pixel is black, mid-range gray, or white. Pixel is one of the gray pixels and has brightness value . Pixel is one of the white pixels and has brightness value . Pixel is one of the black pixels and has brightness value .

The remaining data describes our tiles. We let denote the brightness value of tile , and we set , , and . (Tile 7, the “intersection tile,” is the darkest. Tile 8, the blank tile, is the lightest.) In addition, we set if tile has a line segment that touches its top edge, and we set if it does not. We similarly use , , and to capture the edge information for tile ’s right, left, and bottom edges. Note, for example, that , , , and .

Decision Variables

We use binary variables to model the placing of the tiles on an board. For each position and each tile , we set equal to 1 if we place a copy of tile in position (in place of pixel ) and 0 if we don’t. Here is an example of how this works: In the top right subfigure of Figure 2, we see that and . Finally, note that the total number of decision variables is as there are 8 tile possibilities for each position on an board.

Core Constraints

First, for each position , where and , we impose the equation

We do this to ensure that we assign each position exactly one tile. If position is an “interior” position (not in the top or bottom rows of the board and not in its left or right columns), then the sum is over all tiles (). If not, the sum is over a reduced set of tiles. For example, for position , the equation is , as tiles 2 and 8 are the only ones that can be placed in position without there being a line segment that leaves the board. Second, for each position , where and , we impose the equation

We do this to ensure that the patterns on horizontally adjacent tiles match. In other words, if we assign position a tile that has a line segment that touches the tile’s right edge, then we must make sure that we assign position a tile that has a line segment that touches the tile’s left edge (and vice versa). For

similar reasons, for each position , where and , we impose the equation

We do this to ensure that the patterns on vertically adjacent tiles match. Note that the total number of core constraints is . If our target image has two-fold rotational symmetry and we want our line drawing to have this symmetry as well, we can impose additional constraints: , where stands for the number of the tile we obtain when we rotate tile by .

Auxiliary Variables

We express our objective functions in terms of auxiliary variables (variables that depend on the decision variables). For each position , where and , we define the residual to be

Note that is simply the difference between the brightness value of pixel and the brightness value of the tile that we place in position . We think of as the “ error term” for pixel/position . Somewhat similarly, for each position , where and , we define the residual to be

Note that is the difference between the sum of the brightness values of a block of pixels—pixels , , , and —and the sum of the brightness values of the block of tiles that end up in the corresponding block of positions. Accordingly, we think of as the “ error term” for the block whose upper left corner is pixel/position .

Objective Functions

All of our objective functions take the following form:

where and are nonnegative weight parameters. If we want to minimize the sum of the squares of the residuals, we set and . If we want to minimize the sum of the squares of the residuals, we set and . For most of the artwork displayed in this paper, we used a hybrid approach, setting and .

All of our objective functions are nonlinear, but they can be linearized. When , the linearization can be done at no cost (i.e., with no additional variables). By using the first core constraint and the fact that squaring a binary variable leaves it unchanged, we obtain

where

A New Tile-Based Method for Constructing Single-Line Drawings

which is a linear function of the decision variables.

When w_{2 \times 2} > 0, linearization forces us to include additional binary variables. For each position , where and , and each nonnegative integer that is one of the 9 possible values for the sum of the brightness values of tiles that can be placed in a block of positions, we introduce a binary variable that equals 1 if and only if the sum of the brightness values of the tiles placed in positions , , , and is equal to . With these variables, we can write the square of each residual as

which is a linear function of the variables. For each position , where and , we need to impose the following two linear equality constraints:

and

The first ensures that we assign each position one and only one block brightness value. The second makes sure that the values of the variables and the variables are consistent with one another. Note that the total number of variables is , and the total number of additional constraints is .

Loop Elimination

img-5.jpeg Figure 3: (left) The solution to the first-stage problem (with just the core constraints and symmetry constraints) and (right) the nonsymmetric solution we obtained when we merged the loops.

img-6.jpeg

The lefthand subfigure of Figure 3 shows the solution we obtained on the first stage, when we used the Gurobi Optimizer [3] to minimize our objective function (with ) subject to the core constraints and symmetry constraints. The solution is symmetric and does contain, as desired, a route from the start position to the end position, but this route does not traverse each and every street segment. Some of the untraversed

Bosch and Snyder

segments belong to the U-shaped loop in the top left corner. Others belong to its symmetric counterpart in the bottom right corner. Even more belong to a much larger loop. All of the tiles that form the much larger loop are drawn in red.

On this instance, we can merge the route and the loops into the nonsymmetric solution shown in the righthand subfigure of Figure 3. Alternately, we can eliminate loops by imposing linear inequalities that prohibit their reoccurrence, as is done with TSP subtour elimination constraints [2]. For each loop, we identify the variables that correspond to the tiles that form the loop. Then we add up these variables and force the sum to be strictly less than the number of tiles that form the loop. For the U-shaped loop, the inequality is

The top right subfigure of Figure 2 shows the solution we obtained when we used Gurobi to minimize our objective function subject to the core constraints, the symmetry constraints, and the four loop-elimination constraints from the first stage. (We treated the stage-one route from the start position to the end position as a fourth loop, and we handled it in the same way that we dealt with the others.) On each stage, Gurobi required less than 0.1 seconds on a 2019 MacBook Pro to obtain the optimal solution for the stage.

img-7.jpeg Figure 4: Two single-line drawings that resemble knots, each drawn in knot-like fashion.

img-8.jpeg Additional Examples

Figure 4 contains two higher resolution examples that are based on screenshots of 3D renderings of a trefoil knot and a torus knot. For these drawings (and the rest of those shown in this paper), we gave ourselves permission to vary the thickness of the line in accordance with the target image, making it thinner in brighter regions and thicker in darker regions. We did this to heighten the contrast. For these two pieces, Gurobi required considerably more time (more than a day in each case!) to find the optimal solutions.

Figure 5 displays two single-line renditions of a section of Vermeer’s Girl with a Pearl Earring [6]. The lefthand subfigure shows the optimal solution for the objective function with and .

A New Tile-Based Method for Constructing Single-Line Drawings

Here, Gurobi was able to obtain the optimal solution in less than a minute. The righthand subfigure shows a solution for the objective function with . Gurobi required several hours to obtain this solution, which might not be optimal.

img-9.jpeg Figure 5: Single-line renditions of a section of Vermeer’s Girl with a Pearl Earring. The lefthand version uses and , while the righthand version uses .

img-10.jpeg

The lefthand version looks posterized, as if it were made with only three levels of brightness. The righthand version looks much less posterized and appears to have additional levels of brightness. We believe that by incorporating the error terms into the objective function, we achieve an effect that is similar to what could, in theory, be produced by error diffusion. For comparative purposes, we encourage the reader to step back and view both versions from a distance.

img-11.jpeg Figure 6: (left) “Unicursal weave” and (right) “Doubly unicursal labyrinth.”

img-12.jpeg

Figure 6 contains two additional examples, and Figure 7 contains an additional example.

Bosch and Snyder

Each was made in an attempt to pair this medium (tile-based single-line drawing) with a relevant message (a single-thread weave, a unicursal labyrinth, and a computationally intensive visual pun).

img-13.jpeg Figure 7: “Magic square knot.”

References

[1] R. Bosch. Opt Art: From Mathematical Optimization to Visual Design. Princeton University Press, 2019. [2] W. J. Cook. In Pursuit of the Traveling Salesman: Mathematics at the Limits of Computation. Princeton University Press, 2012. [3] Gurobi optimization. http://www.gurobi.com/products/gurobi-optimizer. [4] E. Lubowicz, ed. Waclaw Szpakowski, 1883-1973: Rhythmical Lines, Culture and Art Center in Wroclaw, Culture Institution of Lover Silesia Province Government, 2015. [5] C. Thompson. A machine for helping you doodle. https://betterhumans.pub/a-machine-for-helping-you-doodle-ce1c38529f2b. [6] J. Vermeer. Girl with a Pearl Earring, 1665. Oil on canvas. Mauritshaus, Den Haag.

0 items under this folder.