# Example: Mosaic from Pompeii

Published 2009-02-09 | Author: Daniel Steger

A decorative element from a mosaic in the living room of Casa degli Armorini Dorati, Pompeii. The example shows the power of PGF’s mathematical engine.

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de. En français: TeXnique.fr.

% Author: Daniel Steger
% Source: Mosaic from Pompeji
% Casa degli Armorini Dorati, Living room, mosaic
\documentclass{minimal}

\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[cap=round]
% Colors
\colorlet{anglecolor}{green!50!black}
\colorlet{bordercolor}{black}

%Configuration: change this to define number of intersections:
% 5 degree mean 360/10 = 36 elements
\def\alpha{5} % degree
\def\layer{5}

\begin{scope}[scale=5]

% The figure is constructed by intersecting circles Cx of radius R.
%  M_Cx lies on the circle C with a radius \alpha degree from the outer circle R
%  and a distance defined by \alpha degree.

% It is sufficent to calculate one special M_C, which is intersecting the x-axis
% at distance R from (0,0).
\pgfmathsetmacro\sinTriDiff{sin(60-\alpha)}
\pgfmathsetmacro\cosTriDiff{1-cos(60-\alpha)}
% The distance from the (0,0).
% Angle of M_C (from x-axis)
\pgfmathsetmacro\startAng{\alpha + atan(\sinTriDiff/\cosTriDiff)}

% The segment layer are \alpha degree apart
\pgfmathsetmacro\al{\alpha*\layer}

% For each segment create the intersection parts of the circles by using arcs
\foreach \x in {0,\alpha,...,\al}
{
% Calculate the polar coordiantes of M_Cx. We take the M_C from above
% and  can calculate all other M_Cx by adding \alpha
\pgfmathsetmacro\ang{\x + \startAng}
% From ths we get the (x,y) coordinates

% Now we intersect each new M_C with the x-axis:
% We can find the radius of concentric inner circles
\pgfmathsetmacro\radiusLayer{\xRs + sqrt( 1 - \yRs*\yRs )}

% To calculate angles for the arcs later, this angle is needed
\pgfmathsetmacro\angRs{acos(\yRs)}

% We need to have the angle from the previous loop as well

\colorlet{anglecolor}{black!\ang!green}

% The loop needs to run a whole.
% We don't want to cope with angles > 360 degree, adapt the limits.
\pgfmathsetmacro\step{2*\alpha - 180}
\pgfmathsetmacro\stop{180-2*\alpha}
\foreach \y in {-180, \step ,..., \stop}
{
\pgfmathsetmacro\deltaAng{\y-\x}
% This are the arcs which are definied by the intersection of 3 circles
\filldraw[color=anglecolor,draw=bordercolor]
arc (\deltaAng+2*\alpha : \deltaAng : \radiusLayer);
}

% helper circles  & lines
%\draw[color=gray] (\xRs,\yRs) circle (1);
%\draw[color=gray] (\xRs,-\yRs) circle (1);
%\draw[color=blue, very thick] (0,0) -- (0:1);
%\draw[color=blue, very thick] (0,0) -- (\ang:\radiusC) -- (\xRs,0);
%\draw[color=blue, very thick] (\xRs,\yRs) -- (0:\radiusLayer);
%\filldraw[color=blue!20, very thick] (\xRs,\yRs) --
% (\xRs,\yRs-0.3) arc (-90:-90+\angRs:0.2) -- cycle;

}
\pgfmathsetmacro\radiusLayer{\xRs + sqrt( 1 - \yRs*\yRs )}
\draw[line width=2, color=bordercolor] (0,0) circle (.8*\radiusLayer);
% There are six elements to create. Avoid angles >360 degree.
\foreach \x in {-60,0,...,240}
{
}
% The outer decoration
\foreach \x in {0, 4, ..., 360}
{
\fill[color=anglecolor] (\x:1) -- (\x+3:1.05) -- (\x+5:1.05) -- (\x+2:1) -- cycle;
\fill[color=anglecolor] (\x+5:1.05) -- (\x+7:1.05) -- (\x+4:1.1) -- (\x+2:1.1) -- cycle;
}
\draw[line width=1, color=bordercolor] (0,0) circle (1);
\draw[line width=1, color=bordercolor] (0,0) circle (1.1);
\end{scope}

\end{tikzpicture}

\end{document}


• #1 Eduardo, October 24, 2009 at 4:26 a.m.

WOW!

• #2 eric magar, February 2, 2010 at 4:16 a.m.

so simple, yet so impressive!

• #3 Luciano, December 30, 2011 at 6:43 p.m.

The example is wonderful.

I just noticed a minor misprint in the name, as the famous house in Pompei is named "Casa degli Amorini", without the "r" at the second place.

Amore = love in Italian (it is also the Latin name of the God of Love, Eros in Greek) Amorini = the cute tiny angels helping the God of Love in His duty.

With the "r", the beautiful word sounds like an ugly one: "Armorini" does not exits in Italian nor in Latin, but "Arma" means weapon.

• #4 Paul, January 1, 2013 at 6:53 a.m.

Absolutely beautiful.