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.

Download as: [PDF] [TEX]  •  [Open in Overleaf]

Mosaic from Pompeii

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


% Colors

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

% Radius R = 1

% 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).
% The distance from the (0,0).
\pgfmathsetmacro\radiusC{sqrt(\cosTriDiff*\cosTriDiff + \sinTriDiff*\sinTriDiff)}
% Angle of M_C (from x-axis)
\pgfmathsetmacro\startAng{\alpha + atan(\sinTriDiff/\cosTriDiff)}

% The segment layer are \alpha degree apart

% 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

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

  % Add some fading by \ang

  % 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}
  \foreach \y in {-180, \step ,..., \stop}
    % This are the arcs which are definied by the intersection of 3 circles 
                arc (-90+\angRs+\deltaAng : \alpha-90+\angRss+\deltaAng :1) 
                arc (\alpha+90-\angRss+\deltaAng : 2*\alpha+90-\angRs+\deltaAng :1)
                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] (0,0) circle (\radiusLayer);
  %\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;

% Additional inner decoration element
\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}
    \fill[color=anglecolor] (\x:\radiusSmall) arc (-180+\x+60: -180+\x: \radiusSmall)
                             arc (0+\x: -60+\x: \radiusSmall)
                             arc (120+\x: 60+\x: \radiusSmall); 
% 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);




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


  • #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.

Adding comments is currently not enabled.