Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc-en / .svn / text-base / par-geode-en.tex.svn-base
1 \section{The object \texttt{geode}}
2
3 \subsection{Mathematical presentation}
4
5 Some excellent tutorials about geodes and their duals are available on the following websites:
6
7 \centerline{\url{http://fr.wikipedia.org/wiki/G\%C3\%A9ode}}
8 %I was not sure whether you meant ``geode'' so I looked up this url.  Wikipedia indicated that there is no article about this.
9
10 The parametrisation of a geode complies with that given on the website:
11
12
13 \centerline{\url{http://hypo.ge-dip.etat-ge.ch/www/math/html/amch104.html}}
14
15 ``\textit{We can define a geode with two parameters: a number $N$ indicating the type of the initial polyhedron  ($N = 3$ for the tetrahedron, $N = 4$ for the octahedron and $N = 5$ for the icosahedron) and a number $n$ indicating the number of divisions along the edge's length.}''
16
17
18 The article \textit{Indexing the Sphere with the Hierarchical Triangular Mesh} describes a method that allows us to obtain a representation of geodes:
19
20
21 \centerline{\url{http://research.microsoft.com/research/pubs/view.aspx?msr_tr_id=MSR-TR-2005-123}}
22
23 \subsection{Construction with pst-solides3d}
24
25 Two approaches are possible to generate a geode or its dual:
26 either via \verb+\codejps+, or via the objects of
27 \Lcs{psSolid}.
28
29 For a geode, the codes
30 \begin{verbatim}
31 \codejps{N n newgeode drawsolid**}
32 \end{verbatim}
33 and
34 \begin{verbatim}
35 \psSolid[object=geode,ngrid=N n]
36 \end{verbatim}
37 are equivalent. And for its dual, the codes
38 \begin{verbatim}
39 \codejps{N n newdualgeode drawsolid**}
40 \end{verbatim}
41 and
42 \begin{verbatim}
43 \psSolid[object=geode,dualreg,ngrid=N n]
44 \end{verbatim}
45
46
47
48 \subsection{Some examples of geodes and their duals}
49
50 \begin{LTXexample}[width=6cm]
51 \begin{pspicture}(-3,-3)(3,3)
52 \psset{viewpoint=50 -20 30 rtp2xyz,Decran=100}
53 \psSolid[object=geode,
54          ngrid=5 0]
55 %\codejps{5 0 newgeode drawsolid**}
56 \psframe*(-2,-2.8)(2,-2.2)
57 \rput(0,-2.5){\textcolor{white}{\textsf{N=5 n=0}}}
58 \end{pspicture}
59 \end{LTXexample}
60 \begin{LTXexample}[width=6cm]
61 \begin{pspicture}(-3,-3)(3,3)
62 \psset{viewpoint=50 -20 30 rtp2xyz,Decran=100}
63 \psSolid[object=geode,
64    dualreg,
65    ngrid=5 0]
66 %\codejps{5 0 newdualgeode drawsolid**}
67 \psframe*(-2,-2.8)(2,-2.2)
68 \rput(0,-2.5){\textcolor{white}{\textsf{N=5 n=0}}}
69 \end{pspicture}
70 \end{LTXexample}
71
72 \begin{LTXexample}[width=6cm]
73 \begin{pspicture}(-3,-3)(3,3)
74 \psset{viewpoint=50 -20 30 rtp2xyz,Decran=100}
75 \psSolid[object=geode,
76    ngrid=5 1]
77 %\codejps{5 1 newgeode drawsolid**}
78 \psframe*(-2,-2.8)(2,-2.2)
79 \rput(0,-2.5){\textcolor{white}{\textsf{N=5 n=1}}}
80 \end{pspicture}
81 \end{LTXexample}
82 \begin{LTXexample}[width=6cm]
83 \begin{pspicture}(-3,-3)(3,3)
84 \psset{viewpoint=50 -20 30 rtp2xyz,Decran=100}
85 \psSolid[object=geode,
86    dualreg,
87    ngrid=5 1]
88 %\codejps{5 1 newdualgeode drawsolid**}
89 \psframe*(-2,-2.8)(2,-2.2)
90 \rput(0,-2.5){\textcolor{white}{\textsf{N=5 n=1}}}
91 \end{pspicture}
92 \end{LTXexample}
93
94 \subsection{The parameters of the \Index{geodes}}
95
96 The radius of the sphere is fixed at 1, so to vary the dimensions of the
97 geodes one plays around with one or the other of the two following parameters:
98 \begin{compactitem}
99   \item The unit: \verb+\psset{unit=2}+
100   \item The position of the screen:
101     \texttt{\Lkeyword{viewpoint}=50 -20 30},\texttt{\Lkeyword{Decran}=100}, if the distance to the screen
102     is twice as far  as the distance to the viewer, one scales the scenery by a factor of two.
103 \end{compactitem}
104
105 \encadre{Within \textit{jps}, the setup for the geode is \textbackslash{}codejps\{\textbf{N n newgeode}\} and
106   for its dual it is \textbackslash{}codejps\{\textbf{N n
107     newdualgeode}\}.}
108
109 \encadre{With \Lcs{psSolid}, the parameters $N$ and $n$ are transmitted via the argument \Lkeyword{ngrid}}
110
111 The color and \Index{transparency} options are available for the geodes as well.
112
113 \begin{LTXexample}[width=7cm]
114 \psset{viewpoint=50 -20 30 rtp2xyz,Decran=150}
115 \begin{pspicture}(-3.5,-3.5)(3.5,3.5)
116 \psset{linewidth=2pt}
117 \codejps{
118 /geode42{4 2 newdualgeode} def
119 .7 setfillopacity
120 orange
121 /geodetransparente{
122 geode42
123 dup videsolid
124 dup (orange) inputcolors
125 dup [.1 .9] solidputhuecolors} def
126 geodetransparente
127 drawsolid**}
128 \end{pspicture}
129 \end{LTXexample}
130
131 \subsection{Advice for a `fast' construction of a geode}
132
133 The calculation time for the geodes and their duals depends on the number of divisions of an edge
134 (the second parameter $n$) and will increase rapidly with $n$
135 which is really uncomfortable, because one has to wait more or less patiently, until
136 the result of the transformation \Cadre{dvips->ps2pdf} is ready.
137
138 As happens for all other solids, it is possible to save the calculation in external files,
139  which then saves calculation time when one has to make a test run of colours or view point.
140
141 We have to operate in two stages:
142
143 \subsubsection{Backup the parameters of the geodes in a \texttt{\Index{.dat}} file}
144
145 \begin{verbatim}
146 \documentclass{article}
147 \usepackage{pst-solides3d}
148 \begin{document}
149 \codejps{
150 4 4 newdualgeode
151  dup {[.5 .6]} exec solidputhuecolors
152 (geodedual44) writesolidfile
153 }
154 \end{document}
155 \end{verbatim}
156 \Cadre{LaTeX->dvips->GSview (Windows)ou gv (Linux)}
157
158 The last operation will generate 4 files:
159 \begin{compactitem}
160   \item \texttt{geodedual44-couleurs.dat} $\rightarrow$ the colors of the faces;
161   \item \texttt{geodedual44-faces.dat} $\rightarrow$ the list of the faces;
162   \item \texttt{geodedual44-sommets.dat} $\rightarrow$ the list of the vertices;
163   \item \texttt{geodedual44-io.dat} $\rightarrow$ the number of the faces and vertices.
164 \end{compactitem}
165
166 \encadre{By default, under Windows and Linux, the security of files on the hard drive is activated and doesn't allow you to write on the drive.
167 To deactivate that security option, more or less temporarily, here the two corresponding procedures:
168
169 \begin{description}
170
171   \item[Linux:] Advice from Jean-Michel \textsc{Sarlat}: the simplest will be to use GhostScript directly, within the console. As there is no image to wait for:
172
173 \$$>$ gs  -dNOSAFER  monfichier.ps quit.ps
174   \item[Windows:] Within the menu \texttt{Options}, the option
175     \textsf{Security of files} must be unchecked.
176 \end{description}}
177
178 \subsubsection{Reading the data and drawing the geode}
179
180 %% \begin{LTXexample}[pos=t]
181 %% \psset{unit=2}
182 %% \psset{lightsrc=10 0 10,SphericalCoor=true,viewpoint=50 -20 30,Decran=100}
183 %% \begin{pspicture}(-2,-2)(2,2)
184 %% \psframe(-2,-2)(2,2)
185 %% \psSolid[object=datfile,file=./geodedual44]
186 %% \end{pspicture}
187 %% \end{LTXexample}
188
189 The advantage of this method becomes even more evident when one compares the compilation of two files producing the same result by different methods:
190
191 The file \texttt{geode42\_direct.tex} calculates the solid  and its view. The file \texttt{geode42\_precalcul.tex} uses the file
192  \texttt{.dat} including the precalculated data of the file
193 \texttt{calc\_geode42.tex}. These three files are included in the distribution.
194
195 \subsection{Some other examples}
196 You will find numerous other  examples of geodes on the website:
197
198 \centerline{\url{http://melusine.eu.org/lab/bpst/pst-solides3d/geodes}}
199
200 \endinput

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.