• R/O
  • SSH

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision49066c52522d179564d54bf487ac3d9b8e9a09fc (tree)
Zeit2019-10-24 17:25:59
AutorLorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

One of the most beautiful tikz images ever made.

Ändern Zusammenfassung

Diff

diff -r 89685f7cffe7 -r 49066c52522d latex-documents/casa_amorini.tex
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/latex-documents/casa_amorini.tex Thu Oct 24 10:25:59 2019 +0200
@@ -0,0 +1,122 @@
1+% Author: Daniel Steger
2+% Source: Mosaic from Pompeji
3+% Casa degli Armorini Dorati, Living room, mosaic
4+\documentclass{minimal}
5+
6+\usepackage{tikz}
7+\usepackage{verbatim}
8+
9+\begin{comment}
10+:Title: Mosaic from Pompeii
11+
12+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.
13+\end{comment}
14+
15+\begin{document}
16+
17+\begin{tikzpicture}[cap=round]
18+% Colors
19+\colorlet{anglecolor}{green!50!black}
20+\colorlet{bordercolor}{black}
21+
22+%Configuration: change this to define number of intersections:
23+% 5 degree mean 360/10 = 36 elements
24+\def\alpha{5} % degree
25+\def\layer{5}
26+
27+\begin{scope}[scale=5]
28+% Radius R = 1
29+
30+% The figure is constructed by intersecting circles Cx of radius R.
31+% M_Cx lies on the circle C with a radius \alpha degree from the outer circle R
32+% and a distance defined by \alpha degree.
33+
34+% It is sufficent to calculate one special M_C, which is intersecting the x-axis
35+% at distance R from (0,0).
36+\pgfmathsetmacro\sinTriDiff{sin(60-\alpha)}
37+\pgfmathsetmacro\cosTriDiff{1-cos(60-\alpha)}
38+% The distance from the (0,0).
39+\pgfmathsetmacro\radiusC{sqrt(\cosTriDiff*\cosTriDiff + \sinTriDiff*\sinTriDiff)}
40+% Angle of M_C (from x-axis)
41+\pgfmathsetmacro\startAng{\alpha + atan(\sinTriDiff/\cosTriDiff)}
42+
43+% The segment layer are \alpha degree apart
44+\pgfmathsetmacro\al{\alpha*\layer}
45+
46+% For each segment create the intersection parts of the circles by using arcs
47+\foreach \x in {0,\alpha,...,\al}
48+{
49+ % Calculate the polar coordiantes of M_Cx. We take the M_C from above
50+ % and can calculate all other M_Cx by adding \alpha
51+ \pgfmathsetmacro\ang{\x + \startAng}
52+ % From ths we get the (x,y) coordinates
53+ \pgfmathsetmacro\xRs{\radiusC*cos(\ang)}
54+ \pgfmathsetmacro\yRs{\radiusC*sin(\ang)}
55+
56+ % Now we intersect each new M_C with the x-axis:
57+ % We can find the radius of concentric inner circles
58+ \pgfmathsetmacro\radiusLayer{\xRs + sqrt( 1 - \yRs*\yRs )}
59+
60+ % To calculate angles for the arcs later, this angle is needed
61+ \pgfmathsetmacro\angRs{acos(\yRs)}
62+
63+ % We need to have the angle from the previous loop as well
64+ \pgfmathsetmacro\angRss{acos(\radiusC*sin(\ang-\alpha))}
65+
66+
67+ % Add some fading by \ang
68+ \colorlet{anglecolor}{black!\ang!green}
69+
70+ % The loop needs to run a whole.
71+ % We don't want to cope with angles > 360 degree, adapt the limits.
72+ \pgfmathsetmacro\step{2*\alpha - 180}
73+ \pgfmathsetmacro\stop{180-2*\alpha}
74+ \foreach \y in {-180, \step ,..., \stop}
75+ {
76+ \pgfmathsetmacro\deltaAng{\y-\x}
77+ % This are the arcs which are definied by the intersection of 3 circles
78+ \filldraw[color=anglecolor,draw=bordercolor]
79+ (\y-\x:\radiusLayer)
80+ arc (-90+\angRs+\deltaAng : \alpha-90+\angRss+\deltaAng :1)
81+ arc (\alpha+90-\angRss+\deltaAng : 2*\alpha+90-\angRs+\deltaAng :1)
82+ arc (\deltaAng+2*\alpha : \deltaAng : \radiusLayer);
83+ }
84+
85+
86+ % helper circles & lines
87+ %\draw[color=gray] (\xRs,\yRs) circle (1);
88+ %\draw[color=gray] (\xRs,-\yRs) circle (1);
89+ %\draw[color=blue] (0,0) circle (\radiusLayer);
90+ %\draw[color=blue, very thick] (0,0) -- (0:1);
91+ %\draw[color=blue, very thick] (0,0) -- (\ang:\radiusC) -- (\xRs,0);
92+ %\draw[color=blue, very thick] (\xRs,\yRs) -- (0:\radiusLayer);
93+ %\filldraw[color=blue!20, very thick] (\xRs,\yRs) --
94+ % (\xRs,\yRs-0.3) arc (-90:-90+\angRs:0.2) -- cycle;
95+
96+}
97+% Additional inner decoration element
98+\pgfmathsetmacro\xRs{\radiusC*cos(\al+\startAng)}
99+\pgfmathsetmacro\yRs{\radiusC*sin(\al+\startAng)}
100+\pgfmathsetmacro\radiusLayer{\xRs + sqrt( 1 - \yRs*\yRs )}
101+\draw[line width=2, color=bordercolor] (0,0) circle (.8*\radiusLayer);
102+\pgfmathsetmacro\radiusSmall{.7*\radiusLayer}
103+% There are six elements to create. Avoid angles >360 degree.
104+\foreach \x in {-60,0,...,240}
105+{
106+ \fill[color=anglecolor] (\x:\radiusSmall) arc (-180+\x+60: -180+\x: \radiusSmall)
107+ arc (0+\x: -60+\x: \radiusSmall)
108+ arc (120+\x: 60+\x: \radiusSmall);
109+}
110+% The outer decoration
111+\foreach \x in {0, 4, ..., 360}
112+{
113+ \fill[color=anglecolor] (\x:1) -- (\x+3:1.05) -- (\x+5:1.05) -- (\x+2:1) -- cycle;
114+ \fill[color=anglecolor] (\x+5:1.05) -- (\x+7:1.05) -- (\x+4:1.1) -- (\x+2:1.1) -- cycle;
115+}
116+\draw[line width=1, color=bordercolor] (0,0) circle (1);
117+\draw[line width=1, color=bordercolor] (0,0) circle (1.1);
118+\end{scope}
119+
120+\end{tikzpicture}
121+
122+\end{document}