Publications / 2018 / Transformation of LEGO Models

Transformation of LEGO Models

Wei Pan, Lujie Chen
Computer-Aided Design and Applications, 15(6):796–806
— Versions
[journal]
Transformation of LEGO Models Computer-Aided Design and Applications, 15(6):796-806

In one sentenceRebuilding one LEGO model into another with few pick-and-place moves while reusing many of its bricks: two approaches and three strategies give six algorithms that balance the two goals.

The problem

Container stacking raises a practical question: how can containers be moved efficiently from one stack to another? This paper studies a remotely related question with LEGO: build a new LEGO model using bricks taken from an existing one. Many algorithms turn a 3D shape into a LEGO model, but constructing a LEGO model from the bricks of another model had not been explored in open literature. The task has two goals that pull against each other. Every pick-and-place (PnP) of a brick costs one move, and as many bricks of the source model as possible should end up in the target.

Physical constraints make the order of moves matter. A brick fully or partly under other bricks cannot be picked, and a brick cannot be placed where it would hang in the air. The authors also treat a top-surface brick that is completely surrounded by other bricks as not movable, because freeing it would take extra moves.

A small LEGO assembly: a yellow 2-by-2 brick on the top surface, completely enclosed by green bricks.
The yellow 2-by-2 brick lies on the top surface but is fully surrounded by green bricks, so the algorithms treat it as not movable. Fig. 2 of the paper.

How it works

The source model is taken apart from the top down and the target is built from the bottom up, layer by layer. Two basic approaches, rigid transformation (RT) and flexible transformation (FT), decide how the target’s bricks are chosen, and three strategies decide where each brick comes from: straight from the source, from a buffer of bricks already removed, or from a stock with an unlimited supply. Combining them gives six algorithms, RT1–RT3 and FT1–FT3, which use seven brick shapes.

  1. Moves and constraints. Each PnP of one brick (source to buffer, source to target, buffer to target or stock to target) counts as a cost of 1. Only movable bricks, those with nothing on top and not fully surrounded, can be picked.
  2. Rigid or flexible target. In rigid transformation (RT), the target LEGO model is generated before the transformation, with large bricks used first on each layer. In flexible transformation (FT), the target is built from an interim voxelized model on the fly: a scoring rule weights each brick type by how many movable bricks of that type the source currently offers, so source bricks are used first.
  3. Strategy 1. The source is disassembled completely into the buffer, and the target is built from the buffer, with the stock filling in bricks the buffer lacks.
  4. Strategy 2. Movable source bricks go straight to the target. If none matches, the buffer is searched; if it has none either, one more layer of the source is disassembled into the buffer to uncover new bricks. The stock is used only when the source is gone.
  5. Strategy 3. No buffer. A matching movable source brick goes straight to the target; otherwise the stock supplies one.
Left: three rows, each with a black-and-white LEGO ball as source and a pink-and-gold LEGO figure as target, rows 1 and 2 routing bricks through a cyan buffer box and row 3 using only a grey stock box. Right: the LEGO ball with RT leading directly to a LEGO target model and FT leading through an interim voxelized model, with zoomed insets of the brick layouts.
Left, the three strategies under each approach (Fig. 4 of the paper): arrow size shows the priority of each route; Strategy 1 goes through the buffer, Strategy 2 prefers the direct route and falls back on the buffer, and Strategy 3 uses only the source and the stock. Right, the two basic approaches (Fig. 3 of the paper): RT generates the target LEGO model beforehand, while FT builds it from an interim voxelized model during the transformation. The two figures are placed side by side here.

The algorithms are compared with three metrics: the cost C, the number of PnP needed to build the target; the reuse rate R = Nr/Ns, the share of the source’s Ns bricks that end up in the target; and an overall performance P = V·R/C, where V is the number of voxels in the target model.

Results

The algorithms were tested on eight triangle mesh models converted to LEGO. In the first test, model A was transformed into each of the other seven models at about 2500 voxels per model. In the second, all eight models were transformed into each other at seven model sizes. Cost grows linearly with model size, and cost drops from Strategy 1 to 2 to 3 at every model size. An FT algorithm costs more than its RT counterpart because FT builds a target with more bricks. FT3 reaches a reuse rate comparable to the best RT algorithms. RT3’s reuse rate is much lower than RT1’s and RT2’s: when the target bricks are fixed in advance and there is no buffer, matching source bricks are hard to find, and on average more than half of the target bricks come from the stock. Reuse rate is not very sensitive to model size above 1700 voxels per model; smaller models reduce it.

The third test added colour: exterior bricks must match the surface colour, while interior bricks may take any colour. For the ball-to-house transformation, RT1 and RT2 reuse 61.9 % and 59.9 % of the bricks, and RT3 only 9.2 % (Fig. 9). The authors note the trade-offs: FT’s higher reuse comes with more and smaller bricks, giving weaker structures with internal sliding planes; the overall performance metric is empirical, and other scenarios may weigh cost differently. The study moves one brick at a time; reusing groups of bricks as modules is left to future work, and the results may not be directly applicable to a specific industrial application such as cargo container stacking.

Three line plots against model size in voxels for FT1–FT3 and RT1–RT3: (a) cost rising linearly, (b) reuse rate roughly flat with RT3 far below the rest, (c) overall performance with FT3 on top.
Average results of transforming the eight models into each other at seven model sizes: (a) cost, (b) reuse rate and (c) overall performance. Fig. 7 of the paper.
Three rows of rendered snapshots showing a LEGO ball being turned into a LEGO house by FT1, FT2 and FT3, with stock, buffer piles and running PnP counts.
FT1, FT2 and FT3 transforming model A (ball) into model H (house) with colour, with the running PnP count under each snapshot. FT3 uses no buffer and finishes at the lowest cost of the three. Fig. 8 of the paper.

Cite

@article{pan2018transformation,
  title={Transformation of LEGO Models},
  author={Pan, Wei and Chen, Lujie},
  journal={Computer-Aided Design and Applications},
  volume={15},
  number={NO. 6},
  pages={796--806},
  year={2018},
  publisher={Taylor \& Francis},
  doi={10.1080/16864360.2018.1477670}
}
Type
Article Journal
Topic
Computational Design
Venue
Computer-Aided Design and Applications, 15(6):796–806
Year
2018
DOI