Herringbone
Herringbone lays bricks twice as long as they are wide, each one set at the end of the last and turned a quarter against it. Take it for a floor, a wall, or any surface that should read as laid rather than ruled.
staggeredBricks draws the running bond, where courses are straight and the
joints are offset. This is the other classic, and the zigzag it makes runs on the diagonal even
though every brick is square to the axes.
Example
<?php
declare(strict_types=1);
use Atelier\Pattern\Pattern;
use Atelier\Pattern\PatternRegistry;
use Atelier\Svg\Document;
use Atelier\Svg\Dumper\CompactXmlDumper;
use Atelier\Svg\Element\Shape\RectElement;
require __DIR__.'/vendor/autoload.php';
$herringbone = Pattern::herringbone(length: 24, gap: 1.6);
$document = Document::create(360, 200);
(new PatternRegistry($herringbone))->attachTo($document);
$surface = new RectElement();
$surface->setX('0')->setY('0')->setWidth('360')->setHeight('200');
$surface->setAttribute('fill', $herringbone->fill());
$document->getRootElement()?->appendChild($surface);
echo (new CompactXmlDumper())->dump($document);
Options
| Setting | Default | Effect |
|---|---|---|
length |
24 |
long side of one brick, always twice its width; the tile is twice the length on both axes |
gap |
1.6 |
mortar between two bricks, taken out of the brick rather than added around it, at most a quarter of the length |
withColor(string) |
currentColor |
paint of the bricks; the mortar stays transparent |
withOpacity(?float) |
none | opacity of the whole tile |
withAngle(float) |
0 |
turns the bond through patternTransform; 45 degrees stands the zigzag upright |
withId(string) |
derived | fixes the identifier instead of deriving it from the tile content |
A gap of 0 removes the mortar. All bricks then have the same fill and no outline, so their
orientation disappears into one solid tone. Any remaining raster hairlines are rendering artifacts.
How the tile closes
Take the half brick as the unit. A brick is two units by one, and each one is paired with a brick
turned a quarter and set at its end. That pair covers four unit squares, and the lattice of pair
positions is generated by the vectors (3, 1) and (-1, 1).
That lattice contains (4, 0) and (0, 4), so four units square is the smallest rectangle the
bond repeats in. It holds exactly four pairs, at (0, 0), (3, 1), (2, 2) and (1, 3).
Sixteen unit squares of tile against sixteen of brick. The count leaves no room for a gap or an overlap, and a test samples the tile on a grid and asserts every point is covered once.
Four of the eight bricks cross an edge, and each one is drawn again a period away, on the far side of the edge it leaves. Twelve rectangles for eight bricks, and the bond joins itself.