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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
%% $Id: pst-platon.sty 208 2009-12-25 08:54:53Z herbert $
%%
%% This is file `pst-platon.sty',
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%%
%% Manuel Luque <Mluque5130 _at_ aol.com> (France)
%% Herbert Voss <hvoss _at_ tug.org (Germany)
%%
%% 2009/12/24
%%
%% DESCRIPTION:
%% `pst-platon' is a package intended for drawing the
%% platonic solids
%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{pstricks}
\RequirePackage{pst-3d}
\RequirePackage{pst-xkey}
\ifx\PSTFPloaded\endinput\else\input{pst-fp.tex}\fi
\def\fileversion{0.01}
\def\filedate{2009/12/25}
%
\ProvidesPackage{pst-platon}[\filedate\ v\fileversion\ platonic solids (ml,hv)]
%
\newcommand\colorTypeA{%
\definecolor{ColorA}{cmyk}{0.1,0.1,0.05,0}
\definecolor{ColorB}{cmyk}{0.15,0.15,0.05,0}
\definecolor{ColorC}{cmyk}{0.2,0.2,0.05,0}
\definecolor{ColorD}{cmyk}{0.25,0.25,0.05,0}
\definecolor{ColorE}{cmyk}{0.3,0.3,0.05,0}
\definecolor{ColorF}{cmyk}{0.35,0.35,0.05,0}
\definecolor{ColorG}{cmyk}{0.4,0.4,0.05,0}
\definecolor{ColorH}{cmyk}{0.45,0.45,0.05,0}
\definecolor{ColorI}{cmyk}{0.5,0.5,0.05,0}
\definecolor{ColorJ}{cmyk}{0.55,0.55,0.05,0}
\definecolor{ColorK}{cmyk}{0.6,0.6,0.05,0}
\definecolor{ColorL}{cmyk}{0.65,0.65,0.05,0}
\definecolor{ColorM}{cmyk}{0.2,0.22,0.07,0}
\definecolor{ColorN}{cmyk}{0.32,0.33,0.09,0}
\definecolor{ColorO}{cmyk}{0.22,0.20,0.05,0}
\definecolor{ColorP}{cmyk}{0.32,0.30,0.05,0}
\definecolor{ColorQ}{cmyk}{0.12,0.2,0.07,0}
\definecolor{ColorR}{cmyk}{0.27,0.33,0.09,0}
\definecolor{ColorS}{cmyk}{0.18,0.20,0.05,0}
\definecolor{ColorT}{cmyk}{0.37,0.30,0.05,0}}
\newcommand\colorTypeB{%
\definecolor{ColorA}{cmyk}{0.1,0.2,0.1,0}
\definecolor{ColorB}{cmyk}{0.15,0.2,0.15,0}
\definecolor{ColorC}{cmyk}{0.2,0.2,0.2,0}
\definecolor{ColorD}{cmyk}{0.25,0.2,0.25,0}
\definecolor{ColorE}{cmyk}{0.3,0.2,0.3,0}
\definecolor{ColorF}{cmyk}{0.35,0.2,0.35,0}
\definecolor{ColorG}{cmyk}{0.4,0,0.4,0}
\definecolor{ColorH}{cmyk}{0.45,0,0.45,0}}
%
\def\pst@t{0.333}
\SpecialCoor%
%
\pst@addfams{pst-platon}
\define@boolkey[psset]{pst-platon}[Pst@]{PstPicture}[true]{}
\define@boolkey[psset]{pst-platon}[Pst@]{Frame}[true]{}
\define@key[psset]{pst-platon}{Viewpoint}[1 1 1]{%
\def\psk@platon@Viewpoint{#1}%
\expandafter\psset@platon@viewpoint#1\@nil}
\def\psset@platon@viewpoint#1 #2 #3\@nil{%
\def\psk@platon@Viewpointx{#1}%
\def\psk@platon@Viewpointy{#2}%
\def\psk@platon@Viewpointz{#3}}
\psset[pst-platon]{Viewpoint=1 1 1,Frame=true,PstPicture=true}
\define@key[psset]{pst-platon}{faceName}[\Alph]{\let\pst@faceName#1}
\define@key[psset]{pst-platon}{faceNameFont}[{\huge\sffamily\bfseries}]{\def\psk@faceNameFont{#1}}
\psset[pst-platon]{faceName=\Alph,faceNameFont={\huge\sffamily\bfseries}}
\define@key[psset]{pst-platon}{colorType}[A]{\csname colorType#1\endcsname}
\psset[pst-platon]{colorType=A}
%
\newcounter{face@counter}
%
\def\pst@ifpos(#1,#2,#3){%
\@ifnextchar[{\pst@ifpos@i(#1,#2,#3)}{\pst@ifpos@i(#1,#2,#3)[#1,#2,#3]}}
\def\pst@ifpos@i(#1,#2,#3)[#4,#5,#6]#7#8{%
\pstFPmul\pst@tempA\psk@platon@Viewpointx{#1}%
\pstFPmul\pst@tempB\psk@platon@Viewpointy{#2}%
\pstFPadd\pst@tempC\pst@tempA\pst@tempB%
\pstFPmul\pst@tempA\psk@platon@Viewpointz{#3}%
\pstFPadd\pst@tempB\pst@tempA\pst@tempC%
\ifdim\pst@tempB pt>\z@ \ThreeDput[normal=#1 #2 #3](#4,#5,#6){#7%
\rput(0,0){\psk@faceNameFont\setcounter{face@counter}{#8}%
\pst@faceName{face@counter}}}\fi%
}
%
\def\psTetrahedron{\pst@object{psTetrahedron}}
\def\psTetrahedron@i{{%
\pst@killglue%
\addbefore@par{fillstyle=solid,dimen=middle,radius=1.633,colorType=B}%
\use@par%
\def\faceA[##1]{\pspolygon[##1](\psk@radius;90)(\psk@radius;210)(\psk@radius;330)}
\def\faceB[##1]{\pspolygon[##1](\psk@radius;30)(\psk@radius;150)(\psk@radius;270)}
\psset[pst-3d]{viewpoint=\psk@platon@Viewpoint}%
\psscalebox{\psk@@psscale}{%
\ifPst@PstPicture\pspicture(-1.4,-1.6)(1.4,1.6)\fi%
\pst@ifpos(1,1,-1)[\pst@t,\pst@t,-\pst@t]{\faceA[fillcolor=ColorA]}{1}% face 1
\pst@ifpos(-1,1,1)[-\pst@t,\pst@t,\pst@t]{\faceB[fillcolor=ColorB]}{2}% face 2
\pst@ifpos(1,-1,1)[\pst@t,-\pst@t,\pst@t]{\faceB[fillcolor=ColorC]}{3}% face 3
\pst@ifpos(-1,-1,-1)[-\pst@t,-\pst@t,-\pst@t]{\faceA[fillcolor=ColorC]}{4}% face 4
\ifPst@Frame\pst@showFrame{}\fi
\ifPst@PstPicture\endpspicture\fi%
}}\ignorespaces}
%
\def\psHexahedron{\pst@object{psHexahedron}}
\def\psHexahedron@i{{%
\pst@killglue%
\addbefore@par{fillstyle=solid,dimen=middle,colorType=B}%
\use@par%
\def\face[##1]{\psframe[##1](-1,-1)(1,1)}%
\psscalebox{\psk@@psscale}{%
\ifPst@PstPicture\pspicture(-1.4,-1.7)(1.4,1.7)\fi%
\psset[pst-3d]{viewpoint=\psk@platon@Viewpoint}%
\pst@ifpos(1,0,0){\face[fillcolor=ColorA]}{1} % face1
\pst@ifpos(0,1,0){\face[fillcolor=ColorB]}{2} % face2
\pst@ifpos(-1,0,0){\face[fillcolor=ColorC]}{3}% face3
\pst@ifpos(0,-1,0){\face[fillcolor=ColorD]}{4}% face4
\pst@ifpos(0,0,1){\face[fillcolor=ColorE]}{5} % face5
\pst@ifpos(0,0,-1){\face[fillcolor=ColorF]}{6}% face6
\ifPst@Frame\pst@showFrame\fi
\ifPst@PstPicture\endpspicture\fi%
}}\ignorespaces}
%
\def\psOctahedron{\pst@object{psOctahedron}}
\def\psOctahedron@i{{%
\pst@killglue%
\addbefore@par{fillstyle=solid,dimen=middle,radius=0.8165,colorType=B}%
\use@par%
\def\faceA[##1]{\pspolygon[##1](\psk@radius;90)(\psk@radius;210)(\psk@radius;330)}
\def\faceB[##1]{\pspolygon[##1](\psk@radius;30)(\psk@radius;150)(\psk@radius;270)}
\psset[pst-3d]{viewpoint=\psk@platon@Viewpoint}%
\psscalebox{\psk@@psscale}{%
\ifPst@PstPicture\pspicture(-1,-1)(1,1)\fi%
\pst@ifpos(1,1,1)[\pst@t,\pst@t,\pst@t]{\faceA[fillcolor=ColorA]}{1}% face 1
\pst@ifpos(-1,1,1)[-\pst@t,\pst@t,\pst@t]{\faceA[fillcolor=ColorB]}{2}% face 2
\pst@ifpos(-1,-1,1)[-\pst@t,-\pst@t,\pst@t]{\faceA[fillcolor=ColorC]}{3}% face 3
\pst@ifpos(1,-1,1)[\pst@t,-\pst@t,\pst@t]{\faceA[fillcolor=ColorD]}{4}% face 4
\pst@ifpos(1,1,-1)[\pst@t,\pst@t,-\pst@t]{\faceB[fillcolor=ColorE]}{5}% face 5
\pst@ifpos(-1,1,-1)[-\pst@t,\pst@t,-\pst@t]{\faceB[fillcolor=ColorF]}{6}% face 6
\pst@ifpos(1,-1,-1)[\pst@t,-\pst@t,-\pst@t]{\faceB[fillcolor=ColorG]}{7}% face 7
\pst@ifpos(-1,-1,-1)[-\pst@t,-\pst@t,-\pst@t]{\faceB[fillcolor=ColorH]}{8}% face 8
\ifPst@Frame\pst@showFrame\fi
\ifPst@PstPicture\endpspicture\fi%
}}\ignorespaces}
%
\def\psDodecahedron{\pst@object{psDodecahedron}}
\def\psDodecahedron@i{{%
\pst@killglue%
\addbefore@par{fillstyle=solid,colorType=A}%
\use@par%
\def\RA{1.05146}\def\rb{0.723607}\def\ra{1.17082}%
\def\rc{0.723607}\def\rd{1.17082}%
\psset[pst-3d]{viewpoint=\psk@platon@Viewpoint}%
\def\faceA[##1]{\pspolygon[##1](\RA;18)(\RA;90)(\RA;162)(\RA;234)(\RA;306)}%
\def\faceB[##1]{\pspolygon[##1](\RA;270)(\RA;-18)(\RA;54)(\RA;126)(\RA;198)}%
\def\faceC[##1]{\pspolygon[##1](\RA;0)(\RA;72)(\RA;144)(\RA;216)(\RA;288)}%
\def\faceD[##1]{\pspolygon[##1](\RA;36)(\RA;108)(\RA;180)(\RA;252)(\RA;324)}%
\psscalebox{\psk@@psscale}{%
\ifPst@PstPicture\pspicture(-1.1,-1.8)(1.1,1.8)\fi%
\pst@ifpos(0,\ra,\rb){\faceA[fillcolor=ColorA]}{1}% face1
\pst@ifpos(0,-\ra,\rb){\faceA[fillcolor=ColorB]}{2}% face2
\pst@ifpos(0,\ra,-\rb){\faceB[fillcolor=ColorC]}{3}% face3
\pst@ifpos(0,-\ra,-\rb){\faceB[fillcolor=ColorD]}{4}% face4
\pst@ifpos(\rc,0,\rd){\faceB[fillcolor=ColorE]}{5}% face5
\pst@ifpos(-\rc,0,\rd){\faceB[fillcolor=ColorF]}{6}% face6
\pst@ifpos(\rc,0,-\rd){\faceA[fillcolor=ColorG]}{7}% face7
\pst@ifpos(-\rc,0,-\rd){\faceA[fillcolor=ColorH]}{8}% face8
\pst@ifpos(\rd,\rc,0){\faceC[fillcolor=ColorI]}{9}% face9
\pst@ifpos(-\rd,\rc,0){\faceD[fillcolor=ColorJ]}{10}% face10
\pst@ifpos(\rd,-\rc,0){\faceD[fillcolor=ColorK]}{11}% face11
\pst@ifpos(-\rd,-\rc,0){\faceC[fillcolor=ColorL]}{12}%face12
\ifPst@Frame\pst@showFrame\fi%
\ifPst@PstPicture\endpspicture\fi%
}}\ignorespaces}
%
\def\psIcosahedron{\pst@object{psIcosahedron}}
\def\psIcosahedron@i{{%
\pst@killglue%
\addbefore@par{fillstyle=solid,radius=1.1547,colorType=A}%
\use@par%
\def\rb{0.539345}\def\ra{1.41202}%
\def\rc{0.539345}\def\rd{1.41202}%
\def\Nx{0.381966}\def\Ny{0.381966}\def\Nz{0.381966}%
\def\Ox{0.872678}\def\Oy{0.872678}\def\Oz{0.872678}%
\def\nx{1}\def\ny{0.381966}\def\nz{0}%
\def\ox{1.42102}\def\oy{0.53945}\def\oz{0}%
\def\faceA[##1]{\pspolygon[##1](\psk@radius;90)(\psk@radius;210)(\psk@radius;330)}
\def\faceB[##1]{\pspolygon[##1](\psk@radius;-90)(\psk@radius;30)(\psk@radius;150)}
\def\faceC[##1]{\pspolygon[##1](\psk@radius;-69.0948)(\psk@radius;50.9502)(\psk@radius;170.9502)}
\def\faceD[##1]{\pspolygon[##1](\psk@radius;-110.9052)(\psk@radius;9.4598)(\psk@radius;129.4598)}
\def\faceE[##1]{\pspolygon[##1](\psk@radius;69.0948)(\psk@radius;189.09498)(\psk@radius;309.09498)}
\def\faceF[##1]{\pspolygon[##1](\psk@radius;110.9052)(\psk@radius;230.9052)(\psk@radius;350.9052)}
\def\faceG[##1]{\pspolygon[##1](\psk@radius;0)(\psk@radius;120)(\psk@radius;240)}
\def\faceH[##1]{\pspolygon[##1](\psk@radius;60)(\psk@radius;180)(\psk@radius;300)}
\psscalebox{\psk@@psscale}{%
\ifPst@PstPicture\pspicture(-1,-2)(1,2)\fi%
\psset[pst-3d]{viewpoint=\psk@platon@Viewpoint}%
\pst@ifpos(0,\ra,\rb){\faceA[fillcolor=ColorA]}{1}% face1
\pst@ifpos(0,-\ra,\rb){\faceA[fillcolor=ColorB]}{2}% face2
\pst@ifpos(0,\ra,-\rb){\faceB[fillcolor=ColorC]}{3}% face3
\pst@ifpos(0,-\ra,-\rb){\faceB[fillcolor=ColorD]}{4}% face4
\pst@ifpos(\rc,0,\rd){\faceB[fillcolor=ColorE]}{5}% face5
\pst@ifpos(-\rc,0,\rd){\faceB[fillcolor=ColorF]}{6}% face6
\pst@ifpos(\rc,0,-\rd){\faceA[fillcolor=ColorG]}{7}% face7
\pst@ifpos(-\rc,0,-\rd){\faceA[fillcolor=ColorH]}{8}% face8
\pst@ifpos(\Nx,\Ny,\Nz)[\Ox,\Oy,\Oz]{\faceC[fillcolor=ColorI]}{9}% face9
\pst@ifpos(-\Nx,\Ny,\Nz)[-\Ox,\Oy,\Oz]{\faceD[fillcolor=ColorJ]}{10}% face10
\pst@ifpos(\Nx,-\Ny,\Nz)[\Ox,-\Oy,\Oz]{\faceD[fillcolor=ColorK]}{11}% face11
\pst@ifpos(-\Nx,-\Ny,\Nz)[-\Ox,-\Oy,\Oz]{\faceC[fillcolor=ColorL]}{12}% face12
\pst@ifpos(\Nx,\Ny,-\Nz)[\Ox,\Oy,-\Oz]{\faceE[fillcolor=ColorM]}{13}% face13
\pst@ifpos(\Nx,-\Ny,-\Nz)[\Ox,-\Oy,-\Oz]{\faceF[fillcolor=ColorN]}{14}% face14
\pst@ifpos(-\Nx,-\Ny,-\Nz)[-\Ox,-\Oy,-\Oz]{\faceE[fillcolor=ColorO]}{15}% face15
\pst@ifpos(-\Nx,\Ny,-\Nz)[-\Ox,\Oy,-\Oz]{\faceF[fillcolor=ColorP]}{16}% face16
\pst@ifpos(\nx,\ny,\nz)[\ox,\oy,\oz]{\faceG[fillcolor=ColorQ]}{17}% face17
\pst@ifpos(\nx,-\ny,\nz)[\ox,-\oy,\oz]{\faceH[fillcolor=ColorR]}{18}% face18
\pst@ifpos(-\nx,-\ny,\nz)[-\ox,-\oy,\oz]{\faceG[fillcolor=ColorS]}{19}% face19
\pst@ifpos(-\nx,\ny,\nz)[-\ox,\oy,\oz]{\faceH[fillcolor=ColorT]}{20}% face20
\ifPst@Frame\pst@showFrame\fi%
\ifPst@PstPicture\endpspicture\fi%
}}\ignorespaces}
%
\def\pst@showFrame{{%
\psset{fillstyle=none,linestyle=dotted}%
\ThreeDput[normal=1 0 0](1,0,0){\psframe(-1,-1)(1,1)}%
\ThreeDput[normal=0 1 0](0,1,0){\psframe(-1,-1)(1,1)}%
\ThreeDput[normal=0 0 1](0,0,1){\psframe(-1,-1)(1,1)}%
\ThreeDput[normal=0 0 -1](0,0,-1){\psframe(-1,-1)(1,1)}%
\ThreeDput[normal=-1 0 0](-1,0,0){\psframe(-1,-1)(1,1)}%
\ThreeDput[normal=0 -1 0](0,-1,0){\psframe(-1,-1)(1,1)}%
}}
%
\endinput
|