summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pst-solides3d/src/par-geode-en.tex
blob: 2092a3000ffed1a9e0a0a922dc96e888e53c9a58 (plain)
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
\section{The object \texttt{geode}}

\subsection{Mathematical presentation}

Some excellent tutorials about geodes and their duals are available on the following websites:

\centerline{\url{http://fr.wikipedia.org/wiki/G\%C3\%A9ode}}
%I was not sure whether you meant ``geode'' so I looked up this url.  Wikipedia indicated that there is no article about this.

The parametrisation of a geode complies with that given on the website:


\centerline{\url{http://hypo.ge-dip.etat-ge.ch/www/math/html/amch104.html}}

``\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.}''


The article \textit{Indexing the Sphere with the Hierarchical Triangular Mesh} describes a method that allows us to obtain a representation of geodes:


\centerline{\url{http://research.microsoft.com/research/pubs/view.aspx?msr_tr_id=MSR-TR-2005-123}}

\subsection{Construction with pst-solides3d}

Two approaches are possible to generate a geode or its dual:
either via \verb+\codejps+, or via the objects of
\Lcs{psSolid}.

For a geode, the codes
\begin{verbatim}
\codejps{N n newgeode drawsolid**}
\end{verbatim}
and
\begin{verbatim}
\psSolid[object=geode,ngrid=N n]
\end{verbatim}
are equivalent. And for its dual, the codes
\begin{verbatim}
\codejps{N n newdualgeode drawsolid**}
\end{verbatim}
and
\begin{verbatim}
\psSolid[object=geode,dualreg,ngrid=N n]
\end{verbatim}



\subsection{Some examples of geodes and their duals}

\begin{LTXexample}[width=6cm]
\begin{pspicture}(-3,-3)(3,3)
\psset{viewpoint=50 -20 30 rtp2xyz,Decran=100}
\psSolid[object=geode,
         ngrid=5 0]
%\codejps{5 0 newgeode drawsolid**}
\psframe*(-2,-2.8)(2,-2.2)
\rput(0,-2.5){\textcolor{white}{\textsf{N=5 n=0}}}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=6cm]
\begin{pspicture}(-3,-3)(3,3)
\psset{viewpoint=50 -20 30 rtp2xyz,Decran=100}
\psSolid[object=geode,
   dualreg,
   ngrid=5 0]
%\codejps{5 0 newdualgeode drawsolid**}
\psframe*(-2,-2.8)(2,-2.2)
\rput(0,-2.5){\textcolor{white}{\textsf{N=5 n=0}}}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[width=6cm]
\begin{pspicture}(-3,-3)(3,3)
\psset{viewpoint=50 -20 30 rtp2xyz,Decran=100}
\psSolid[object=geode,
   ngrid=5 1]
%\codejps{5 1 newgeode drawsolid**}
\psframe*(-2,-2.8)(2,-2.2)
\rput(0,-2.5){\textcolor{white}{\textsf{N=5 n=1}}}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=6cm]
\begin{pspicture}(-3,-3)(3,3)
\psset{viewpoint=50 -20 30 rtp2xyz,Decran=100}
\psSolid[object=geode,
   dualreg,
   ngrid=5 1]
%\codejps{5 1 newdualgeode drawsolid**}
\psframe*(-2,-2.8)(2,-2.2)
\rput(0,-2.5){\textcolor{white}{\textsf{N=5 n=1}}}
\end{pspicture}
\end{LTXexample}

\subsection{The parameters of the \Index{geodes}}

The radius of the sphere is fixed at 1, so to vary the dimensions of the
geodes one plays around with one or the other of the two following parameters:
\begin{compactitem}
  \item The unit: \verb+\psset{unit=2}+
  \item The position of the screen:
    \texttt{\Lkeyword{viewpoint}=50 -20 30},\texttt{\Lkeyword{Decran}=100}, if the distance to the screen
    is twice as far  as the distance to the viewer, one scales the scenery by a factor of two.
\end{compactitem}

\encadre{Within \textit{jps}, the setup for the geode is \textbackslash{}codejps\{\textbf{N n newgeode}\} and
  for its dual it is \textbackslash{}codejps\{\textbf{N n
    newdualgeode}\}.}

\encadre{With \Lcs{psSolid}, the parameters $N$ and $n$ are transmitted via the argument \Lkeyword{ngrid}}

The color and \Index{transparency} options are available for the geodes as well.

\begin{LTXexample}[width=7cm]
\psset{viewpoint=50 -20 30 rtp2xyz,Decran=150}
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psset{linewidth=2pt}
\codejps{
/geode42{4 2 newdualgeode} def
.7 setfillopacity
orange
/geodetransparente{
geode42
dup videsolid
dup (orange) inputcolors
dup [.1 .9] solidputhuecolors} def
geodetransparente
drawsolid**}
\end{pspicture}
\end{LTXexample}

\subsection{Advice for a `fast' construction of a geode}

The calculation time for the geodes and their duals depends on the number of divisions of an edge
(the second parameter $n$) and will increase rapidly with $n$
which is really uncomfortable, because one has to wait more or less patiently, until
the result of the transformation \Cadre{dvips->ps2pdf} is ready.

As happens for all other solids, it is possible to save the calculation in external files,
 which then saves calculation time when one has to make a test run of colours or view point.

We have to operate in two stages:

\subsubsection{Backup the parameters of the geodes in a \texttt{\Index{.dat}} file}

\begin{verbatim}
\documentclass{article}
\usepackage{pst-solides3d}
\begin{document}
\codejps{
4 4 newdualgeode
 dup {[.5 .6]} exec solidputhuecolors
(geodedual44) writesolidfile
}
\end{document}
\end{verbatim}
\Cadre{LaTeX->dvips->GSview (Windows)ou gv (Linux)}

The last operation will generate 4 files:
\begin{compactitem}
  \item \texttt{geodedual44-couleurs.dat} $\rightarrow$ the colors of the faces;
  \item \texttt{geodedual44-faces.dat} $\rightarrow$ the list of the faces;
  \item \texttt{geodedual44-sommets.dat} $\rightarrow$ the list of the vertices;
  \item \texttt{geodedual44-io.dat} $\rightarrow$ the number of the faces and vertices.
\end{compactitem}

\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.
To deactivate that security option, more or less temporarily, here the two corresponding procedures:

\begin{description}

  \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:

\$$>$ gs  -dNOSAFER  monfichier.ps quit.ps
  \item[Windows:] Within the menu \texttt{Options}, the option
    \textsf{Security of files} must be unchecked.
\end{description}}

\subsubsection{Reading the data and drawing the geode}

%% \begin{LTXexample}[pos=t]
%% \psset{unit=2}
%% \psset{lightsrc=10 0 10,SphericalCoor=true,viewpoint=50 -20 30,Decran=100}
%% \begin{pspicture}(-2,-2)(2,2)
%% \psframe(-2,-2)(2,2)
%% \psSolid[object=datfile,file=./geodedual44]
%% \end{pspicture}
%% \end{LTXexample}

The advantage of this method becomes even more evident when one compares the compilation of two files producing the same result by different methods:

The file \texttt{geode42\_direct.tex} calculates the solid  and its view. The file \texttt{geode42\_precalcul.tex} uses the file
 \texttt{.dat} including the precalculated data of the file
\texttt{calc\_geode42.tex}. These three files are included in the distribution.

\subsection{Some other examples}
You will find numerous other  examples of geodes on the website:

\centerline{\url{http://melusine.eu.org/lab/bpst/pst-solides3d/geodes}}

\endinput