laylight tour
0/31
1/6

Shape operations · 1 of 6

Combining shapes

Shapes can be combined into new shapes. A shape statement takes an expression of other shapes instead of a primitive:

shape bar + post as cross

+ is the union: the region covered by bar or post. a | b means the same, in the style of Luceda IPKISS. The long form shape union with bar, post as cross does too.

The result is a derived shape, and three rules make it fit in:

  • it lies where its operands are placed, so it is not placed itself;
  • operands on the same layer are replaced by it and are not written on their own, so the overlap is not drawn twice;
  • its anchors work like any shape's: cross.top_center is the top of the merged outline.

Exercise

The cross is two overlapping bars. Merge them into one shape named cross, so that the layout has a single 12-corner polygon instead of two rectangles.

loading compiler…

Edit the code, watch the layout, then press Submit to check your solution against the exercise.

Compiling…