• R/O
  • SSH

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Révisione3d3b6149f73db4112d74b67d4bc32437719f8a7 (tree)
l'heure2024-05-27 20:54:47
AuteurLorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Message de Log

A black and white version of the Pompei mosaic.

Change Summary

Modification

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