Bonjour,
Quelqu'un a t-il déjà fait un mandala en LaTeX ?
merci
Bonjour,
Quelqu'un a t-il déjà fait un mandala en LaTeX ?
merci
Bonjour,
il y a un exemple avec TikZ sur TeXample.net :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208 % Mandala % Author: Elena Botoeva \documentclass{article} \usepackage[margin=0.3cm, paperwidth=8.4cm, paperheight=8.4cm]{geometry} \usepackage{tikz} %%%< \usepackage{verbatim} %%%> \begin{comment} :Title: Mandala :Tags: Foreach;Fadings;Decorative Drawings :Author: Elena Botoeva :Slug: mandala Maṇḍala means "circle" in Sanskrit. Mandalas are concentric diagrams, which have a spiritual and ritual meaning in both Buddhism and Hinduism. Here we use TikZ for drawing such geometric patterns. The fading slows down the compilation. \end{comment} \usetikzlibrary{shadows} \usetikzlibrary{fadings} \tikzfading[name=fade out, inner color=transparent!0, outer color=transparent!100] \def\petal { [rounded corners=0.5] % (-1,0)% .. controls (-1,0.6) and (-0.07,0.8).. (0,1)% .. controls (0.07,0.8) and (1,0.6).. (1,0)% .. controls (0.7,-1) and (-0.7,-1).. (-1,0)% } %%%%% circles in the background %%%%% \def\background[#1,#2]{ \fill[#1] (0,0) circle (3.9); \fill[#2] (0,0) circle (1); } %%%%% star and small circle in the center %%%%% \def\center[#1]{ \foreach \a in {51.4285,102.857,...,360} { % \draw[color=yellow,rotate=\a,fill=#1] (-0.08,0) -- (0,0.46) -- (0.08,0); % } \draw[color=yellow,fill=#1] (0,0) circle (0.1); } %%%%%%%%%% Mandala with fixed colouring %%%%%%%%%% \def \mandala { \background[red!30!blue!70!black,blue!70!yellow!50]; % ysh - yshift % xs - xscale % ys - yscale % af - first angle in foreach % as - second angle in foreach % y - number in the color specification after yellow % b - number in the color specification before blue % r - number in the color specification of the shading after red % bl - number in the color specification of the shading before black \foreach \ysh/\xs/\ys/\af/\as/\y/\b/\w/\r/\bl in {% 3.06/0.72/0.8/ 25.71425/51.4285/ 70/100/100/ 100/100,% 2.34/1/0.9/ 25.71425/77.14275/ 6/90/92/ 80/80,% 1.8/0.8/0.9/ 51.4285/102.857/ 0/75/100/ 60/70,% 1.5/0.6/0.6/ 25.71425/77.14275/ 0/55/100/ 40/60,% 1.1/0.53/0.58/ 51.4285/102.857/ 0/40/100/ 20/50,% 0.8/0.37/0.45/ 25.71425/77.14275/ 0/45/85/ 20/40,% 0.53/0.1/0.24/ 25.71425/77.14275/ 0/10/100/ 0/30,% 0.49/0.22/0.32/ 51.4285/102.857/ 0/10/100/ 0/50% } { \foreach \a in {\af,\as,...,360} { \begin{scope}[rotate=\a,shift={(0,\ysh)},xscale=\xs,yscale=\ys] \draw[color=yellow,fill=yellow!\y!red!\b!blue!\w] % [drop shadow={shadow xshift=0.5pt, shadow yshift=-0.5pt}] \petal; \end{scope} \begin{scope}[transform canvas={rotate=\a},shift={(0,\ysh)},xscale=\xs,yscale=\ys] \clip \petal; % \fill[path fading=fade out,fill=red!\r!blue!\bl!black, opacity=0.7]% (0,-0.35) ellipse (1.2 and 0.75); \fill[path fading=fade out,fill=red!\r!blue!\bl!black, opacity=0.3]% (0,-0.2) ellipse (1.2 and 0.4); \fill[path fading=fade out,fill=red!\r!blue,opacity=0.2] % (-0.4,0.6) -- (0,0.9) -- (0.4,0.6); \end{scope} } } \center[blue] } %%%%%%%%%% End of Mandala with fixed colouring %%%%%%%%%% %%%%% one layer of petals %%%%% \def\mainbody{ \foreach \a in {\af,\as,...,360} { \begin{scope}[rotate=\a,shift={(0,\ysh)},xscale=\xs,yscale=\ys] \draw[color=yellow,fill=\c] % [drop shadow={shadow xshift=0.5pt, shadow yshift=-0.5pt}] \petal; \end{scope} % fadings \begin{scope}[transform canvas={rotate=\a}, shift={(0,\ysh)},xscale=\xs,yscale=\ys] \clip \petal; % \fill[path fading=fade out,fill=\fc, opacity=0.7]% (0,-0.35) ellipse (1.2 and 0.75); \fill[path fading=fade out,fill=\fc, opacity=0.3]% (0,-0.2) ellipse (1.2 and 0.4); \fill[path fading=fade out,fill=\fc,opacity=0.2] % (-0.4,0.6) -- (0,0.9) -- (0.4,0.6); \end{scope} } } %%%%%%%%%%% Mandalas with parametrized colouring %%%%%%%%%% % #1 - the color of the outer most (first) layer % #2 - the color of the third layer % #3 - the color of the fifth layer % #4 - the color of the seventh layer % #5 - the color of the fading, gets denser closer to the center \def \mandalac[#1,#2,#3,#4,#5]{ \background[#3!30!#4!70!#5,#4!70!#2!50]; % ysh - yshift % xs - xscale % ys - yscale % af - first angle in foreach % as - second angle in foreach % c - color of the petal % fc - color of the fading \foreach \ysh/\xs/\ys/\af/\as/\c/\fc in {% 3.06/0.72/0.8/ 25.71425/51.4285 /#1/#1!50!#2!90!#5,% 2.34/1/0.9/ 25.71425/77.14275/#1!50!#2/#2!80!#5,% 1.8/0.8/0.9/ 51.4285/102.857 /#2/#2!50!#3!70!#5,% 1.5/0.6/0.6/ 25.71425/77.14275/#2!50!#3/#3!60!#5,% 1.1/0.53/0.58/ 51.4285/102.857 /#3/#3!50!#4!50!#5,% 0.8/0.37/0.45/ 25.71425/77.14275/#3!50!#4/#4!40!#5,% 0.53/0.1/0.24/ 25.71425/77.14275/#4/#4!50!#5,% 0.49/0.22/0.32/ 51.4285/102.857 /#4/#4!50!#5% } { \mainbody } \center[#4] } % #1 - the color of the outer most (first) layer % #2 - the color of the second layer % #3 - the color of the third layer % #4 - the color of the forth layer % #5 - the color of the fifth layer % #6 - the color of the sixth layer % #7 - the color of the seventh layer % #8 - the color of the fading, gets denser closer to the center \def \mandalab[#1,#2,#3,#4,#5,#6,#7,#8]{ \background[#6!30!#7!70!#8,#7!70!#4!50]; % ysh - yshift % xs - xscale % ys - yscale % af - first angle in foreach % as - second angle in foreach % c - color of the petal % fc - color of the fading \foreach \ysh/\xs/\ys/\af/\as/\c/\fc in {% 3.06/0.72/0.8/ 25.71425/51.4285 /#1/#2!90!#8,% 2.34/1/0.9/ 25.71425/77.14275/#2/#3!90!#8,% 1.8/0.8/0.9/ 51.4285/102.857 /#3/#4!80!#8,% 1.5/0.6/0.6/ 25.71425/77.14275/#4/#5!80!#8,% 1.1/0.53/0.58/ 51.4285/102.857 /#5/#6!70!#8,% 0.8/0.37/0.45/ 25.71425/77.14275/#6/#7!70!#8,% 0.53/0.1/0.24/ 25.71425/77.14275/#7/#7!50!#8,% 0.49/0.22/0.32/ 51.4285/102.857 /#7/#7!50!#8% } { \mainbody } \center[#7] } %%%%%%%%%%% End of Mandalas with parametrized colouring %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%% BEGIN DOCUMENT %%%%%%%%%%%%%%%%%%%%%%%% \pagestyle{empty} \setlength{\parindent}{0pt} \begin{document} \tikz\mandala; \tikz\mandalac[magenta!30!,magenta,purple,violet,]; \tikz\mandalac[blue!40!black,violet,purple,pink,]; \tikz\mandalac[lime!90!black,yellow!95!black,orange,red,]; \tikz\mandalac[green!80!black,yellow,pink,purple!90!,red]; \tikz\mandalab[green!50!black, green!60!black, green!70!black!80!, green!50!, green!10!, pink!40!, red!40!,]; \tikz\mandalab[blue!30!black, blue!40!black, blue!60!black, blue!70!black!80!, blue!50!, yellow!40!, yellow!70!,]; \end{document}
C'est beau, non ?
Mais quelle idée saugrenue ! Je pense qu'il y a moyen de faire des choses bien. Essaie d'utiliser \usepackage{poilsdeyack}
Benoit LANDRIEU
https://gitlab.com/benoitldr/beamerarticle-teacher
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager