Debian Codegraph @

texmf-dist/source/latex/pst-gr3d/pst-gr3d.dtx

raw
1 % \iffalse meta-comment, etc.
2 %%
3 %% Package `pst-gr3d.dtx'
4 %%
5 %% Denis Girou (CNRS/IDRIS - France) <[email protected]>
6 %% Herbert Voss <[email protected]>
7 %%
8 %% This program can be redistributed and/or modified under the terms
9 %% of the LaTeX Project Public License Distributed from CTAN archives
10 %% in directory macros/latex/base/lppl.txt.
11 %%
12 %% DESCRIPTION:
13 %% `pst-gr3d' is a PSTricks package to draw three dimensional grids
14 %% with various customization
15 %%
16 % \fi
17 %
18 % \changes{v1.34}{2005/09/12}{(hv) switch to extended version of keyvalue interface}
19 % \changes{v1.33}{2005/01/14}{(hv) fixed introduced bug}
20 % \changes{v1.32}{2005/01/13}{(hv) new package wrapper for pst-gr3d.tex}
21 % \changes{v1.31}{2004/06/23}{(hv) delete the PstDebug option and use the one
22 % the one from pstricks, to prevent a clash with
23 % pst-fill}
24 % \changes{v1.3}{2001/02/19}{Changed conventions for units and updates
25 % in the example macros and the examples.}
26 % \changes{v1.2}{1998/09/16}{Standard packaging (.ins + .dtx files).}
27 % \changes{v1.1}{1998/03/27}{First public release.}
28 %
29 % \DoNotIndex{\!,\",\#,\$,\%,\&,\',\(,\+,\*,\,,\-,\.,\/,\:,\;,\<,\=,\>,\?}
30 % \DoNotIndex{\@,\@B,\@K,\@cTq,\@f,\@fPl,\@ifnextchar,\@nameuse,\@oVk}
31 % \DoNotIndex{\[,\\,\],\^,\_,\ }
32 % \DoNotIndex{\^,\\^,\\\^,$\^$,$\\^$,$\\^$}
33 % \DoNotIndex{\0,\2,\4,\5,\6,\7,\8,}
34 % \DoNotIndex{\A,\a}
35 % \DoNotIndex{\B,\b,\Bc,\begin,\Bq,\Bqc}
36 % \DoNotIndex{\C,\c,\catcode,\cJA,\CodelineIndex,\csname}
37 % \DoNotIndex{\D,\def,\define@key,\Df,\divide,\DocInput,\documentclass,\pst@addfams}
38 % \DoNotIndex{\eCN,\edef,\else,\eHd,\eMcj,\EnableCrossrefs,\end,\endcsname}
39 % \DoNotIndex{\endCenterExample,\endExample,\endinput,\endpsclip}
40 % \DoNotIndex{\PrintIndex,\PrintChanges,\ProvidesFile}
41 % \DoNotIndex{\endpspicture,\endSideBySideExample,\Example}
42 % \DoNotIndex{\F,\f,\FdUrr,\fi,\filedate,\fileversion,\FV@Environment}
43 % \DoNotIndex{\FV@UseKeyValues,\FV@XRightMargin,\FVB@Example,\fvset}
44 % \DoNotIndex{\G,\g,\GetFileInfo,\gr,\GradientLoaded,\gsFKrbK@o,\gsj,\gsOX}
45 % \DoNotIndex{\hbadness,\hfuzz,\HLEmphasize,\HLMacro,\HLMacro@i}
46 % \DoNotIndex{\HLReverse,\HLReverse@i,\hqcu,\HqY}
47 % \DoNotIndex{\I,\i,\ifx,\input,\Ir,\IU}
48 % \DoNotIndex{\j,\jl,\JT,\JVodH}
49 % \DoNotIndex{\K,\k,\kfSlL}
50 % \DoNotIndex{\L,\let}
51 % \DoNotIndex{\message,\mHNa,\mIU}
52 % \DoNotIndex{\N,\nB,\newcmykcolor,\newdimen,\newif,\nW}
53 % \DoNotIndex{\O,\oCDJDo,\ocQhVI,\OnlyDescription,\oRKJ}
54 % \DoNotIndex{\P,\p,\ProvidesPackage,\psframe,\pslinewidth,\psset}
55 % \DoNotIndex{\PstAtCode,\PSTricksLoaded}
56 % \DoNotIndex{\q,\Qr,\qssRXq,\qu,\qXjFQp,\qYL}
57 % \DoNotIndex{\R,\r,\RecordChanges,\relax,\RlaYI,\rN,\Rp,\rp,\RPDXNn,\rput}
58 % \DoNotIndex{\S,\scalebox,\SgY,\SideBySide@Example,\SideBySideExample}
59 % \DoNotIndex{\SgY,\sk,\Sp,\space,\sZb}
60 % \DoNotIndex{\T,\the,\tw@}
61 % \DoNotIndex{\u,\UiSWGEf@,\uJi,\usepackage,\uVQdMM,\UYj}
62 % \DoNotIndex{\VerbatimEnvironment,\VerbatimInput,\VrC@}
63 % \DoNotIndex{\WhZ,\WjKCYb,\WNs}
64 % \DoNotIndex{\XkN,\XW}
65 % \DoNotIndex{\Z,\ZCM,\Ze}
66 % \DoNotIndex{\addtocounter,\advance,\alph,\arabic,\AtBeginDocument,\AtEndDocument}
67 % \DoNotIndex{\AtEndOfPackage,\begingroup,\bfseries,\bgroup,\box,\csname}
68 % \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\expandafter,\fi}
69 % \DoNotIndex{\TeX,\z@,\p@,\@one,\xdef,\thr@@,\string,\sixt@@n,\reset,\or,\multiply,\repeat,\RequirePackage}
70 % \DoNotIndex{\@cclvi,\@ne,\@ehpa,\@nil,\copy,\dp,\global,\hbox,\hss,\ht,\ifodd,\ifdim,\ifcase,\kern}
71 % \DoNotIndex{\chardef,\loop,\leavevmode,\ifnum,\lower}
72 % \setcounter{IndexColumns}{2}
73 %
74 % \setcounter{IndexColumns}{2}
75 %
76 % \newcommand{\PstGridThreeDPackage}{`\textsf{pst-gr3d}'}
77 % \newcommand{\PstGridThreeDMacro}{\cs{PstGridThreeD}}
78 %
79 % ^^A From ltugboat.cls
80 %
81 % ^^A Typeset the name of an environment
82 % \providecommand\env[1]{\textsf{#1}}
83 % \providecommand\clsname[1]{\textsf{#1}}
84 % \providecommand\pkgname[1]{\textsf{#1}}
85 % \providecommand\optname[1]{\textsf{#1}}
86 % \providecommand\progname[1]{\textsf{#1}}
87 %
88 % ^^A A list of options for a package/class
89 % \newenvironment{optlist}{\begin{description}%
90 % \renewcommand\makelabel[1]{%
91 % \descriptionlabel{\mdseries\optname{##1}}}%
92 % \itemsep0.25\itemsep}%
93 % {\end{description}}
94 %
95 % ^^A Utility macros
96 %
97 %
98 % ^^A Example macros - adapted from the `fvrb-ex' package
99 % ^^A ---------------------------------------------------
100 %
101 % ^^A Take care that we use here the four /?_W characters as escape
102 % ^^A characters, so we can't use these characters in the examples!
103 %
104 % \makeatletter
105 %
106 % ^^A To highlight some verbatim sequences (comments, macro names, etc.)
107 % \def\HLEmphasize#1{\textit{#1}}
108 % \newcommand{\BS}{\texttt{\symbol{`\\}}}
109 % \def\HLMacro#1{\BS{}def\HLMacro@i#1\@nil}
110 % \def\HLMacro@i#1def#2\@nil{\HLReverse{#2}}
111 % \def\HLReverse#1{{\setlength{\fboxsep}{1pt}\HLReverse@i{#1}}}
112 % \def\HLReverse@i#1{\colorbox{black}{\textcolor{white}{\textbf{#1}}}}
113 %
114 % \def\Example{\FV@Environment{}{Example}}
115 % \def\endExample{%
116 % \end{VerbatimOut}
117 % \Below@Example{\input{\jobname.tmp}}
118 % \endgroup}
119 %
120 % \def\CenterExample{\FV@Environment{}{Example}}
121 % \def\endCenterExample{%
122 % \end{VerbatimOut}
123 % \begin{center}
124 % \Below@Example{\input{\jobname.tmp}}
125 % \end{center}
126 % \endgroup}
127 %
128 % \def\SideBySideExample{\FV@Environment{}{Example}}
129 % \def\endSideBySideExample{%
130 % \end{VerbatimOut}
131 % \SideBySide@Example{\input{\jobname.tmp}}
132 % \endgroup}
133 %
134 % \def\FVB@Example{%
135 % \begingroup
136 % \FV@UseKeyValues
137 % \parindent=0pt
138 % \multiply\topsep by 2
139 % \VerbatimEnvironment
140 % \begin{VerbatimOut}[gobble=4,codes={\catcode`\W=12}]{\jobname.tmp}}
141 %
142 % \def\Below@Example#1{%
143 % \VerbatimInput[gobble=0,commentchar=W,commandchars=/?_,frame=single,
144 % numbers=left,numbersep=3pt]{\jobname.tmp}
145 % \catcode`\%=14\relax
146 % \catcode`\W=9\relax
147 % ^^A We suppress the effect of the highlighting macros
148 % \catcode`/=0\relax
149 % \catcode`?=1\relax
150 % \catcode`_=2\relax
151 % \def\HLEmphasize##1{##1}%
152 % \def\HLMacro##1{##1}%
153 % \def\HLReverse##1{##1}%
154 % #1
155 % \par}
156 %
157 % \def\SideBySide@Example#1{%
158 % \vskip 1mm
159 % \@tempdimb=\FV@XRightMargin
160 % \advance\@tempdimb -5mm
161 % \begin{minipage}[c]{\@tempdimb}
162 % \fvset{xrightmargin=0pt}
163 % \catcode`\%=14\relax
164 % \catcode`\W=9\relax
165 % ^^A We suppress the effect of the highlighting macros
166 % \catcode`/=0\relax
167 % \catcode`?=1\relax
168 % \catcode`_=2\relax
169 % \def\HLEmphasize##1{##1}%
170 % \def\HLMacro##1{##1}%
171 % \def\HLReverse##1{##1}%
172 % #1
173 % \end{minipage}%
174 % \@tempdimb=\textwidth
175 % \advance\@tempdimb -\FV@XRightMargin
176 % \advance\@tempdimb 5mm
177 % \begin{minipage}[c]{\@tempdimb}
178 % \VerbatimInput[gobble=0,commentchar=W,commandchars=/?_,
179 % frame=single,numbers=left,numbersep=3pt,
180 % xleftmargin=5mm,xrightmargin=0pt]{\jobname.tmp}
181 % \end{minipage}
182 % \vskip 1mm}
183 %
184 % \makeatother
185 %
186 % ^^A End of example macros from `fvrb-ex'
187 %
188 % ^^A For the possible index and changes log
189 % \setlength{\columnseprule}{0.6pt}
190 %
191 % ^^A Beginning of the documentation itself
192 %
193 % \title{The \PstGridThreeDPackage{} package\\
194 % A PSTricks package for three dimensional grids}
195 % \author{Denis \textsc{Girou}\thanks{CNRS/IDRIS ---
196 % Centre National de la Recherche Scientifique /
197 % Institut du D\'eveloppement et des Ressources en Informatique
198 % Scientifique --- Orsay --- France ---
199 % \mbox{\texttt{<[email protected]>}}.}}
200 % \date{Version 1.34\\\ 2005-09-12\\
201 % {\small Documentation revised \today\ by Herbert Voss}}
202 %
203 % \maketitle
204 %
205 % \begin{abstract}
206 % This package allow to draw three dimensional grids using the macro
207 % \PstGridThreeDMacro. We can also specify how nodes of the grid must look
208 % like.
209 % \end{abstract}
210 %
211 % \tableofcontents
212 %
213 % \section{Introduction}
214 %
215 % \PstGridThreeDPackage{} offer a main unique macro with few parameters to
216 % interact on it. But we can also use all the relevant PSTricks parameters to
217 % change the size, the characteristics of lines, etc.
218 %
219 % \vspace{1mm}
220 % The syntax is simply:%
221 % \fbox{\PstGridThreeDMacro\texttt{[optional\_parameters](X,Y,Z)}}
222 %
223 % \vspace{1mm}
224 % We can define a macro \PstGridThreeDMacro\texttt{HookNode} to specify how
225 % the nodes at the interconnections must look like, and there are also some
226 % other \emph{hooks} that can be used for special purposes.
227 %
228 % The default viewpoint is (\texttt{1.2,-0.6,0.8}), but this can of course be
229 % changed using the standard way.
230 %
231 % The package try to compute approximatively the size of the object (the
232 % \texttt{pspicture} parameter, PSTricks speaking), but for three dimensional
233 % grids it is an impossible task to found it accurately in the general case.
234 % So, if the exact size is needed or if we change the viewpoint for the
235 % graphic, the size must be computed \emph{by hand}, using the
236 % \cs{psframebox[framesep=0]\{...\}} construction to found the correct values
237 % by attempts and errors --- fortunately, in practice few attempts are often
238 % enough...
239 %
240 % \section{Usage}
241 %
242 % \subsection{Parameters and hooks}
243 %
244 % The three required parameters specify the lengths in the X, Y and Z
245 % directions, respectively:
246 %
247 % \begin{CenterExample}
248 % \PstGridThreeD(3,1,1)\hfill
249 % \PstGridThreeD(1,3,1)\hfill
250 % \PstGridThreeD(1,1,3)
251 % \end{CenterExample}
252 %
253 % Of course, we can use all the relevant generic PSTricks parameters,
254 % specially those applying to grids:
255 %
256 % \begin{CenterExample}
257 % \PstGridThreeD[unit=1.5](1,1,1)\hfill
258 % \PstGridThreeD[viewpoint=1.2 -1.5 0.4,griddots=7](1,3,2)\hfill
259 % \PstGridThreeD[gridwidth=0.08,gridcolor=red](3,2,2)\hfill
260 % \begin{pspicture}(-1.7,0)(0.8,3.6)
261 % \PstGridThreeD[viewpoint=-0.4 -0.6 0.8,PstPicture=false](1,3,2)
262 % \end{pspicture}
263 % \end{CenterExample}
264 %
265 % We can draw one and two dimensional grids, using degenerated cases:
266 %
267 % \begin{CenterExample}
268 % \PstGridThreeD(0,4,0)\hfill
269 % \PstGridThreeD[linewidth=0.05](0,3,1)\hfill
270 % \PstGridThreeD[griddots=5](3,1,0)
271 % \end{CenterExample}
272 %
273 % To change the way the grids are drawn, we can also use \textbf{nine}
274 % specific parameters and \textbf{five} specific \emph{hooks}:
275 %
276 % \begin{optlist}
277 % \item [PstDebug (integer)]: to obtain some internal debugging informations
278 % --- here, a framed box around the boundix box used (the \texttt{pspicture}
279 % environment) could be drawn. It can take the values 0 (no debug) or 1.
280 % (\emph{Default:~0} --- no debugging informations).
281 % \end{optlist}
282 %
283 % \begin{optlist}
284 % \item [PstPicture (boolean)]: to define or not a \texttt{pspicture}
285 % environment for the grid. We have to define this parameter to \emph{false}
286 % mainly if we choose a viewpoint different than the default one --- see
287 % examples later
288 % (\emph{Default:~true} --- which is not the case for basic PSTricks
289 % objects).
290 % \end{optlist}
291 %
292 % \begin{optlist}
293 % \item [GridThreeDXUnit (integer)]: unit coefficient in the X direction
294 % (\emph{Default:~1} --- it must be an integer, not a real).
295 % \item [GridThreeDYUnit (integer)]: unit coefficient in the Y direction
296 % (\emph{Default:~1} --- it must be an integer, not a real).
297 % \item [GridThreeDZUnit (integer)]: unit coefficient in the Z direction
298 % (\emph{Default:~1} --- it must be an integer, not a real).
299 % \end{optlist}
300 %
301 % \begin{CenterExample}
302 % \PstGridThreeD[/HLEmphasize?GridThreeDXUnit_=/HLReverse?2_](1,1,1)\hfill
303 % \PstGridThreeD[/HLEmphasize?GridThreeDYUnit_=/HLReverse?3_](1,1,1)\hfill
304 % \PstGridThreeD[unit=0.5,/HLEmphasize?GridThreeDZUnit_=/HLReverse?4_](4,3,1)
305 % \end{CenterExample}
306 %
307 % \begin{optlist}
308 % \item [GridThreeDXPos (integer)]: position of the origin in the X direction
309 % (\emph{Default:~0} --- it must be an integer, not a real).
310 % \item [GridThreeDYPos (integer)]: position of the origin in the Y direction
311 % (\emph{Default:~0} --- it must be an integer, not a real).
312 % \item [GridThreeDZPos (integer)]: position of the origin in the Z direction
313 % (\emph{Default:~0} --- it must be an integer, not a real).
314 % \end{optlist}
315 %
316 % These parameters are in fact mainly useful if we want to superpose grids,
317 % which can be done easily using the \cs{PstGridThreeDHookEnd} macro (see
318 % description below):
319 %
320 % \begin{CenterExample}
321 % % /HLEmphasize?First grid_
322 % /HLMacro?\def\PstGridThreeDHookEnd_{%
323 % \PstGridThreeD[/HLEmphasize?PstPicture_=/HLReverse?false_,gridwidth=0.1,
324 % /HLEmphasize?GridThreeDXPos_=/HLReverse?1_](0,2,1)}
325 % \PstGridThreeD(1,3,2)\hfill
326 % % /HLEmphasize?Second grid_
327 % /HLMacro?\def\PstGridThreeDHookEnd_{%
328 % \PstGridThreeD[/HLEmphasize?PstPicture_=/HLReverse?false_,gridwidth=0.1,
329 % /HLEmphasize?GridThreeDYPos_=/HLReverse?1_](1,2,1)}
330 % \PstGridThreeD(1,3,2)\hfill
331 % % /HLEmphasize?Third grid_
332 % /HLMacro?\def\PstGridThreeDHookEnd_{%
333 % \PstGridThreeD[/HLEmphasize?PstPicture_=/HLReverse?false_,gridwidth=0.1,
334 % gridcolor=green,
335 % /HLEmphasize?GridThreeDYPos_=/HLReverse?2_,
336 % /HLEmphasize?GridThreeDZPos_=/HLReverse?1_](1,1,1)}
337 % \PstGridThreeD(1,3,2)
338 % \end{CenterExample}
339 %
340 % \begin{optlist}
341 % \item [GridThreeDNodes (boolean)]: to define or not the nodes at
342 % interconnection points of the grid. The nodes are named
343 % \texttt{Gr3dNodeXYZ}. We can use the \texttt{Rx} and \texttt{Ry} parameters
344 % to position the relevant material relatively to the nodes, specifying the
345 % distance in cartesian coordinates. The parameter \texttt{angle} used with
346 % \texttt{Rx} allow to use polar ones.
347 % (\emph{Default:~false} --- no nodes defined).
348 % \end{optlist}
349 %
350 % \begin{SideBySideExample}[xrightmargin=4cm]
351 % \PstGridThreeD[/HLEmphasize?GridThreeDNodes_=/HLReverse?true_](1,3,1)
352 % \SpecialCoor
353 % \rput*(/HLEmphasize?Gr3dNode130_){\footnotesize 130}
354 % \rput*(/HLEmphasize?Gr3dNode131_){\footnotesize 131}
355 % \end{SideBySideExample}
356 %
357 % \begin{optlist}
358 % \item [\cs{PstGridThreeDHookNode} (macro)]: this hook allow to define the
359 % form of the nodes. A predefined \cs{PstGridThreeDNodeProcessor} macro
360 % exist, which define a circle with a little white circle in it. We can also
361 % use the \cs{iy} counter to differentiate the nodes according to the Y
362 % faces --- but note that we can't do the same thing for the X or Z faces
363 % (\emph{Default:~empty}).
364 % \end{optlist}
365 %
366 % \begin{CenterExample}
367 % % /HLEmphasize?First grid_
368 % /HLMacro?\def\PstGridThreeDHookNode_{%
369 % \begin{pspicture}(-0.15,-0.15)(0.15,0.15)
370 % \pscircle*[linecolor=magenta]{0.15}
371 % \end{pspicture}}
372 % \PstGridThreeD(1,2,2)\hfill
373 % % /HLEmphasize?Second grid_
374 % \definecolor{LightBlue}{rgb}{0.68,0.85,0.9}
375 % /HLMacro?\def\PstGridThreeDHookNode_{%
376 % \PstGridThreeDNodeProcessor{LightBlue}}
377 % \PstGridThreeD[unit=0.7](2,3,3)\hfill
378 % % /HLEmphasize?Third grid_
379 % /HLMacro?\def\PstGridThreeDHookNode_{%
380 % \ifcase\iy
381 % \PstGridThreeDNodeProcessor{magenta}%
382 % \or\PstGridThreeDNodeProcessor{yellow}%
383 % \or\PstGridThreeDNodeProcessor{cyan}%
384 % \else\PstGridThreeDNodeProcessor{green}%
385 % \fi}
386 % \PstGridThreeD(1,3,1)
387 % \end{CenterExample}
388 %
389 % \begin{optlist}
390 % \item [\cs{PstGridThreeDHookEnd} (macro)]: this hook allow to execute a
391 % macro at the end of the grid drawing, before the \texttt{pspicture}
392 % environment closing. This is specially interesting for instance to
393 % superpose grids, if we take care to define the \texttt{PstPicture}
394 % parameter to false for them
395 % (\emph{Default:~empty}).
396 % \end{optlist}
397 %
398 % \begin{CenterExample}
399 % /HLMacro?\def\PstGridThreeDHookEnd_{{%
400 % \psset{/HLEmphasize?PstPicture_=/HLReverse?false_,gridwidth=0.1}
401 % {/HLMacro?\def\PstGridThreeDHookNode_{%
402 % \PstGridThreeDNodeProcessor{blue}}%
403 % \PstGridThreeD[gridcolor=blue,
404 % /HLEmphasize?GridThreeDZPos_=/HLReverse?3_](0,7,0)}%
405 % {/HLMacro?\def\PstGridThreeDHookNode_{%
406 % \PstGridThreeDNodeProcessor{red}}%
407 % \PstGridThreeD[gridcolor=red,
408 % /HLEmphasize?GridThreeDXPos_=/HLReverse?1_,
409 % /HLEmphasize?GridThreeDZPos_=/HLReverse?1_](0,3,1)}%
410 % {/HLMacro?\def\PstGridThreeDHookNode_{%
411 % \PstGridThreeDNodeProcessor{green}}%
412 % \PstGridThreeD[gridcolor=green,
413 % /HLEmphasize?GridThreeDYPos_=/HLReverse?6_](1,1,1)}}}
414 % \PstGridThreeD(1,7,3)
415 % \end{CenterExample}
416 %
417 % \begin{optlist}
418 % \item [\cs{PstGridThreeDHookXFace} (macro)]: this hook allow to execute
419 % a macro before to draw the X faces
420 % (\emph{Default:~empty}).
421 % \item [\cs{PstGridThreeDHookYFace} (macro)]: this hook allow to execute
422 % a macro before to draw the Y faces
423 % (\emph{Default:~empty}).
424 % \item [\cs{PstGridThreeDHookZFace} (macro)]: this hook allow to execute
425 % a macro before to draw the Z faces
426 % (\emph{Default:~empty}).
427 % \end{optlist}
428 %
429 % In fact, these hooks are not very powerful, because we can't control the
430 % order of the faces drawing as we can dream... For instance, we can't use this
431 % technic to draw objects with only \emph{true} visible lines. Take care also
432 % that for the Y faces, the direction is negative in the horizontal direction,
433 % so the coordinates must take this fact in account.
434 %
435 % \begin{CenterExample}
436 % {/HLMacro?\def\PstGridThreeDHookXFace_{%
437 % \ifnum\multidocount=1\psframe*[linecolor=cyan](3,2)\fi}%
438 % \PstGridThreeD(1,3,2)}\hfill
439 % {/HLMacro?\def\PstGridThreeDHookYFace_{%
440 % \ifnum\multidocount=2\psframe*[linecolor=yellow](-3,0)(0,2)\fi}%
441 % \PstGridThreeD(3,1,2)}\hfill
442 % {/HLMacro?\def\PstGridThreeDHookZFace_{%
443 % \ifnum\multidocount=2
444 % \else
445 % \psframe*[linecolor=yellow](3,3)
446 % \fi}%
447 % \PstGridThreeD(3,3,2)}
448 % \end{CenterExample}
449 %
450 % \section{Examples}
451 %
452 % We give here more advanced examples, most of them from technical drawings
453 % describing the architecture of a multiprocessors supercomputer.
454 %
455 % \begin{SideBySideExample}[xrightmargin=4cm]
456 % \PstGridThreeD[/HLEmphasize?GridThreeDNodes_=/HLReverse?true_](2,2,2)
457 % \SpecialCoor
458 % \rput*(/HLEmphasize?Gr3dNode002_){\tiny 002}
459 % \rput*(/HLEmphasize?Gr3dNode221_){\tiny 221}
460 % \rput([Rx=0.3]/HLEmphasize?Gr3dNode222_){\tiny 222}
461 % \multido{\i=0+1}{3}{%
462 % \rput([Rx=0.3,Ry=-0.3]/HLEmphasize?Gr3dNode2\i0_){2\i0}}
463 % \end{SideBySideExample}
464 %
465 % \begin{SideBySideExample}[xrightmargin=4cm]
466 % \definecolor{LightBlue}{rgb}{0.68,0.85,0.9}
467 % /HLMacro?\def\PstGridThreeDHookNode_{%
468 % \PstGridThreeDNodeProcessor{LightBlue}}
469 % \PstGridThreeD[/HLEmphasize?GridThreeDNodes_=/HLReverse?true_](1,2,2)
470 % \SpecialCoor
471 % \rput([Rx=-0.15,Ry=0.3]/HLEmphasize?Gr3dNode122_){%
472 % \psline{<-}(0.5;35)}
473 % \rput([Rx=0.35,Ry=0.8]/HLEmphasize?Gr3dNode122_){Network}
474 % \rput([Rx=0.15,angle=-40]/HLEmphasize?Gr3dNode110_){%
475 % \psline{<-}(0.8;-60)}
476 % \rput([Rx=0.25,angle=-100]/HLEmphasize?Gr3dNode120_){%
477 % \psline{<-}(0.8;-100)}
478 % \rput([Rx=1.5,angle=-55]/HLEmphasize?Gr3dNode010_){Nodes}
479 % \end{SideBySideExample}
480 %
481 % \begin{SideBySideExample}[xrightmargin=4cm]
482 % \definecolor{Orange}{rgb}{1.,0.65,0.}
483 % /HLMacro?\def\PstGridThreeDHookNode_{%
484 % \PstGridThreeDNodeProcessor{Orange}}
485 % \psset{unit=1.3}
486 % \PstGridThreeD[/HLEmphasize?GridThreeDNodes_=/HLReverse?true_](1,2,2)
487 % \SpecialCoor
488 % \psset{arrows=<->,arrowscale=2}
489 % \ThreeDput[normal=0 0 -1](0,0,0){%
490 % \ncloop[linecolor=red,arm=0.35,
491 % loopsize=0.6,angleA=-90,angleB=90]
492 % {/HLEmphasize?Gr3dNode022_}{/HLEmphasize?Gr3dNode002_}
493 % \ncloop[linecolor=green,arm=0.7,
494 % nodesepA=0.18,nodesepB=0.12,
495 % loopsize=-0.5,angleA=180]
496 % {/HLEmphasize?Gr3dNode002_}{/HLEmphasize?Gr3dNode102_}}
497 % \end{SideBySideExample}
498 %
499 % \begin{CenterExample}
500 % /HLMacro?\def\PstGridThreeDHookEnd_{{%
501 % \psset{/HLEmphasize?PstPicture_=/HLReverse?false_,gridwidth=0.1}
502 % {/HLMacro?\def\PstGridThreeDHookNode_{%
503 % \PstGridThreeDNodeProcessor{blue}}%
504 % \PstGridThreeD[gridcolor=blue,
505 % /HLEmphasize?GridThreeDZPos_=/HLReverse?3_](0,7,0)}%
506 % {/HLMacro?\def\PstGridThreeDHookNode_{%
507 % \PstGridThreeDNodeProcessor{red}}%
508 % \PstGridThreeD[gridcolor=red,
509 % /HLEmphasize?GridThreeDXPos_=/HLReverse?1_,
510 % /HLEmphasize?GridThreeDZPos_=/HLReverse?1_](0,3,1)}%
511 % {/HLMacro?\def\PstGridThreeDHookNode_{%
512 % \PstGridThreeDNodeProcessor{green}}%
513 % \PstGridThreeD[gridcolor=green,
514 % /HLEmphasize?GridThreeDYPos_=/HLReverse?6_](1,1,1)}}}
515 % \PstGridThreeD[gridwidth=0.04,
516 % /HLEmphasize?GridThreeDNodes_=/HLReverse?true_](1,7,3)
517 % \SpecialCoor
518 % \rput([Rx=0.15,angle=140]/HLEmphasize?Gr3dNode033_){%
519 % \psline[linecolor=blue]{<-}(0.8;150)}
520 % \rput([Rx=0.95,angle=140]/HLEmphasize?Gr3dNode033_){%
521 % \shortstack{1d grid\\\footnotesize (X=8,Y=1,Z=1)}}
522 % \rput([Rx=0.15,angle=-50]/HLEmphasize?Gr3dNode121_){%
523 % \psline[linecolor=red]{<-}(1.2;-50)}
524 % \rput([Rx=1.5,angle=-55]/HLEmphasize?Gr3dNode121_){%
525 % \shortstack{2d grid\\\footnotesize (X=4,Y=2,Z=1)}}
526 % \rput([Rx=0.2,angle=-100]/HLEmphasize?Gr3dNode160_){%
527 % \psline[linecolor=green]{<-}(0.8;-100)}
528 % \rput([Rx=1.4,angle=-100]/HLEmphasize?Gr3dNode160_){%
529 % \shortstack{3d grid\\\footnotesize (X=2,Y=2,Z=2)}}
530 % \end{CenterExample}
531 %
532 %
533 % \StopEventually{}
534 %
535 % ^^A .................... End of the documentation part ....................
536 %
537 % \section{Driver file}
538 %
539 % The next bit of code contains the documentation driver file for \TeX{},
540 % i.e., the file that will produce the documentation you are currently
541 % reading. It will be extracted from this file by the \texttt{docstrip}
542 % program.
543 %
544 % \begin{macrocode}
545 %<*driver>
546 \documentclass{ltxdoc}
547 \GetFileInfo{pst-gr3d.dtx}
548 \usepackage{fancyvrb}
549 \usepackage{pstricks}
550 \usepackage[colorlinks,linktocpage]{hyperref}
551 \usepackage{pst-gr3d}
552 %
553 \AtBeginDocument{
554 % \OnlyDescription % comment out for implementation details
555 \EnableCrossrefs
556 \CodelineIndex
557 \RecordChanges}
558 \AtEndDocument{
559 \PrintIndex
560 \setcounter{IndexColumns}{1}
561 \PrintChanges}
562 \hbadness=7000 % Over and under full box warnings
563 \hfuzz=3pt
564 \begin{document}
565 \DocInput{pst-gr3d.dtx}
566 \end{document}
567 %</driver>
568 % \end{macrocode}
569 %
570 % \section{\PstGridThreeDPackage{} \LaTeX{} wrapper}
571 %
572 % \begin{macrocode}
573 %<*latex-wrapper>
574 \RequirePackage{pstricks}
575 \ProvidesPackage{pst-gr3d}[2005/01/13 package wrapper for
576 pst-gr3d.tex (hv)]
577 \input{pst-gr3d.tex}
578 \ProvidesFile{pst-gr3d.tex}
579 [\filedate\space v\fileversion\space `PST-gr3d' (dg)]
580 %</latex-wrapper>
581 % \end{macrocode}
582 %
583 % \section{\PstGridThreeDPackage{} code}
584 %
585 % \begin{macrocode}
586 %<*pst-gr3d>
587 % \end{macrocode}
588 %
589 % \subsection{Preambule}
590 %
591 % Who we are.
592 %
593 % \begin{macrocode}
594 \def\fileversion{1.34}
595 \def\filedate{2005/09/12}
596 \message{`PST-Grid3d' v\fileversion, \filedate\space (Denis Girou)}
597 \csname PSTGridThreeDLoaded\endcsname
598 \let\PSTGridThreeDLoaded\endinput
599 % \end{macrocode}
600 %
601 % Require the PSTricks, `\textsf{pst-node}', `\textsf{pst-3d}' and
602 % `\textsf{multido}' packages.
603 %
604 % \begin{macrocode}
605 \ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi
606 \ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi
607 \ifx\PSTthreeDLoaded\endinput\else\input pst-3d.tex\fi
608 \ifx\MultidoLoaded\endinput\else\input multido.tex\fi
609 % \end{macrocode}
610 %
611 % interface to the extended `\textsf{keyval}' package.
612 %
613 % \begin{macrocode}
614 \ifx\PSTXKeyLoaded\endinput\else\input pst-xkey\fi
615 %%
616 % \end{macrocode}
617 %
618 % Catcodes changes and defining the family name for xkeyvalue.
619 %
620 % \begin{macrocode}
621 \edef\PstAtCode{\the\catcode`\@}\catcode`\@=11\relax
622 \pst@addfams{pst-gr3d}
623 %%
624 % \end{macrocode}
625 %
626 % \subsection{Definition of the parameters}
627 %
628 % \texttt{PstDebug} is for internal debugging purposes --- here, a framed box
629 % around the grid is shown (to debug, set \texttt{PstDebug=1}).
630 %
631 % \begin{macrocode}
632 %% change Pst@Debug to prevent a clash with pst-fill
633 %% which has the same option. Now pstricks defines Pst@Debug
634 %%\define@key[psset]{pst-gr3d}{PstDebug}{\pst@getint{#1}{\Pst@Debug}}
635 %% end hv 2004-06-22
636 % \end{macrocode}
637 %
638 % \texttt{PstPicture} allow to define a ``\texttt{pspicture}'' environment.
639 %
640 % \begin{macrocode}
641 \newif\ifPst@PstPicture
642 \define@key[psset]{pst-gr3d}{PstPicture}[true]{\@nameuse{Pst@PstPicture#1}}
643 % \end{macrocode}
644 %
645 % \texttt{GridThreeDNodes} allow to define nodes on the grid.
646 %
647 % \begin{macrocode}
648 \newif\ifPstGridThreeD@Nodes
649 \define@key[psset]{pst-gr3d}{GridThreeDNodes}[true]{%
650 \@nameuse{PstGridThreeD@Nodes#1}}
651 % \end{macrocode}
652 %
653 % \texttt{GridThreeDXUnit}, \texttt{GridThreeDYUnit} and
654 % \texttt{GridThreeDZUnit} define the X, Y and Z units (must be integers).
655 %
656 % \begin{macrocode}
657 \define@key[psset]{pst-gr3d}{GridThreeDXUnit}{%
658 \pst@getint{#1}{\PstGridThreeD@XUnit}}
659 \define@key[psset]{pst-gr3d}{GridThreeDYUnit}{%
660 \pst@getint{#1}{\PstGridThreeD@YUnit}}
661 \define@key[psset]{pst-gr3d}{GridThreeDZUnit}{%
662 \pst@getint{#1}{\PstGridThreeD@ZUnit}}
663 % \end{macrocode}
664 %
665 % \texttt{GridThreeDXPos}, \texttt{GridThreeDYPos} and
666 % \texttt{GridThreeDZPos} define the X, Y and Z positions.
667 %
668 % \begin{macrocode}
669 \define@key[psset]{pst-gr3d}{GridThreeDXPos}{%
670 \pst@getint{#1}{\PstGridThreeD@XPos}}
671 \define@key[psset]{pst-gr3d}{GridThreeDYPos}{%
672 \pst@getint{#1}{\PstGridThreeD@YPos}}
673 \define@key[psset]{pst-gr3d}{GridThreeDZPos}{%
674 \pst@getint{#1}{\PstGridThreeD@ZPos}}
675 % \end{macrocode}
676 %
677 % \texttt{Rx} and \texttt{Ry} are aliases for relative moves from nodes.
678 %
679 % \begin{macrocode}
680 \define@key[psset]{pst-gr3d}{Rx}{\psset{XnodesepA=#1}}
681 \define@key[psset]{pst-gr3d}{Ry}{\psset{offsetA=#1}}
682 % \end{macrocode}
683 %
684 % Default values (including \texttt{viewpoint} first).
685 %
686 % \begin{macrocode}
687 \psset{viewpoint=1.2 -0.6 0.8}
688 \psset{%
689 PstDebug=0,PstPicture=true,GridThreeDNodes=false,
690 GridThreeDXPos=0,GridThreeDYPos=0,GridThreeDZPos=0,
691 GridThreeDXUnit=1,GridThreeDYUnit=1,GridThreeDZUnit=1}
692 % \end{macrocode}
693 %
694 % \subsection{Main macro}
695 %
696 % The general \cs{PstGridThreeD} macro to draw three dimensional grids.
697 %
698 % \begin{macro}{\PstGridThreeD}
699 % \begin{macrocode}
700 \def\PstGridThreeD{\@ifnextchar[{\PstGridThreeD@i}{\PstGridThreeD@i[]}}
701 % \end{macrocode}
702 % \end{macro}
703 %
704 % \begin{macro}{\PstGridThreeD@i}
705 % \begin{macrocode}
706 \def\PstGridThreeD@i[#1](#2,#3,#4){{%
707 \psset{dimen=middle}%
708 \psset{#1}%
709 % \end{macrocode}
710 %
711 % First, we try to compute rather accurate values for the
712 % ``\texttt{pspicture}'' environment (it is not possible to found them in the
713 % general case, so we must define our own ones, setting \texttt{PstPicture}
714 % to false before, if the ones automatically computed here are really wrong
715 % in our case...).
716 %
717 % Ymin pspicture value.
718 %
719 % \begin{macrocode}
720 \pst@cnth=#2
721 \multiply\pst@cnth\PstGridThreeD@XUnit
722 \divide\pst@cnth\tw@
723 \ifodd\pst@cnth
724 \edef\PstGridThreeD@PictureYmin{-\the\pst@cnth}%
725 \else
726 \edef\PstGridThreeD@PictureYmin{-\the\[email protected]}%
727 \fi
728 % \end{macrocode}
729 %
730 % Xmax pspicture value (stored in \cs{pst@cntg}).
731 %
732 % \begin{macrocode}
733 \pst@cntg=#3
734 \multiply\pst@cntg\PstGridThreeD@YUnit
735 \pst@cnth=#2
736 \divide\pst@cnth\tw@
737 \multiply\pst@cnth\PstGridThreeD@XUnit
738 \advance\pst@cntg\pst@cnth
739 % \end{macrocode}
740 %
741 % Ymax pspicture value.
742 %
743 % \begin{macrocode}
744 \pst@cnth=#3
745 \advance\pst@cnth\m@ne
746 \multiply\pst@cnth\PstGridThreeD@YUnit
747 \divide\pst@cnth\tw@
748 \pst@cntd=#4
749 \multiply\pst@cntd\PstGridThreeD@ZUnit
750 \advance\pst@cntd\pst@cnth
751 \ifnum\pst@cnth=\z@
752 \edef\PstGridThreeD@PictureYmax{\the\[email protected]}%
753 \else
754 \edef\PstGridThreeD@PictureYmax{\the\pst@cntd}%
755 \fi
756 % \end{macrocode}
757 %
758 % If required, the pspicture environment.
759 %
760 % \begin{macrocode}
761 \ifPst@PstPicture
762 % \end{macrocode}
763 %
764 % If \texttt{PstDebug=1}, we draw a framed box around the grid.
765 %
766 % \begin{macrocode}
767 \ifnum\Pst@Debug=\@ne
768 \psframebox[framesep=0]{%
769 \fi
770 % \end{macrocode}
771 %
772 % \begin{macrocode}
773 \pspicture(0,\PstGridThreeD@PictureYmin)
774 (\the\pst@cntg,\PstGridThreeD@PictureYmax)
775 \fi
776 % \end{macrocode}
777 %
778 % \begin{macrocode}
779 \pst@cntd=\PstGridThreeD@XPos
780 \multiply\pst@cntd\PstGridThreeD@XUnit
781 \pst@cntg=\PstGridThreeD@YPos
782 \multiply\pst@cntg\PstGridThreeD@YUnit
783 \pst@cnth=\PstGridThreeD@ZPos
784 \multiply\pst@cnth\PstGridThreeD@ZUnit
785 % \end{macrocode}
786 %
787 % Z faces (only if \cs{PstGridThreeDHookZFace} is defined).
788 %
789 % \begin{macrocode}
790 \ifx\PstGridThreeDHookZFace\empty
791 \else
792 \pst@cntc=#4
793 \advance\pst@cntc\@ne
794 \multido{\iz=#4+-\PstGridThreeD@ZUnit}{\pst@cntc}{% Z face hook
795 \ThreeDput[normal=0 0 1](\pst@cntd,\pst@cntg,\iz){\PstGridThreeDHookZFace}}
796 \fi
797 % \end{macrocode}
798 %
799 % X faces.
800 %
801 % \begin{macrocode}
802 \pst@cntc=#2
803 \advance\pst@cntc\@ne
804 \multido{\ix=\pst@cntd+\PstGridThreeD@XUnit}{\pst@cntc}{%
805 \ThreeDput[normal=1 0 0](\ix,\pst@cntg,\pst@cnth){%
806 % \end{macrocode}
807 %
808 % with an X face hook.
809 %
810 % \begin{macrocode}
811 \PstGridThreeDHookXFace
812 \psgrid[xunit=\PstGridThreeD@YUnit,yunit=\PstGridThreeD@ZUnit,
813 subgriddiv=0,gridlabels=0](#3,#4)}}
814 % \end{macrocode}
815 %
816 % Y faces.
817 %
818 % \begin{macrocode}
819 \pst@cnta=#3
820 \multiply\pst@cnta\PstGridThreeD@YUnit
821 \advance\pst@cnta\pst@cntg
822 \pst@cntc=#3
823 \advance\pst@cntc\@ne
824 \multido{\iy=\pst@cnta+-\PstGridThreeD@YUnit}{\pst@cntc}{%
825 \ThreeDput[normal=0 1 0](\pst@cntd,\iy,\pst@cnth){%
826 \PstGridThreeDYFace{#2}{#4}{\iy}}}
827 % \end{macrocode}
828 %
829 % Hook at the end, if defined.
830 %
831 % \begin{macrocode}
832 \PstGridThreeD@HookEnd
833 % \end{macrocode}
834 %
835 % Then we close the ``\texttt{pspicture}'' environment, if defined.
836 %
837 % \begin{macrocode}
838 \ifPst@PstPicture
839 \endpspicture
840 % \end{macrocode}
841 %
842 % If \texttt{PstDebug=1}, we close of the framed box.
843 %
844 % \begin{macrocode}
845 \ifnum\Pst@Debug=\@ne
846 }
847 \fi
848 % \end{macrocode}
849 %
850 % And we close the \cs{PstGridThreeD@} macro.
851 %
852 % \begin{macrocode}
853 \fi}}
854 % \end{macrocode}
855 % \end{macro}
856 %
857 % One face of the three dimensional grid.
858 %
859 % \begin{macro}{\PstGridThreeDYFace}
860 % \begin{macrocode}
861 \def\PstGridThreeDYFace#1#2#3{%
862 % \end{macrocode}
863 %
864 % Vertical faces.
865 %
866 % First, Y face hook.
867 %
868 % \begin{macrocode}
869 \PstGridThreeDHookYFace%
870 \psgrid[xunit=\PstGridThreeD@XUnit,yunit=\PstGridThreeD@ZUnit,
871 subgriddiv=0,gridlabels=0](-#1,#2)
872 \pst@cnta=#1
873 \advance\pst@cnta\@ne
874 \pst@cntb=#2
875 \advance\pst@cntb\@ne
876 \pst@cntg=#3
877 \multido{\ia=0+-\PstGridThreeD@XUnit}{\pst@cnta}{%
878 \pst@cntc=\multidocount
879 \advance\pst@cntc\m@ne
880 \multido{\ib=0+\PstGridThreeD@ZUnit}{\pst@cntb}{%
881 % \end{macrocode}
882 %
883 % Nodes definition.
884 %
885 % \begin{macrocode}
886 \ifPstGridThreeD@Nodes
887 \pst@cntd=\multidocount
888 \advance\pst@cntd\m@ne
889 \pnode(\ia,\ib){Gr3dNode\the\pst@cntc\the\pst@cntg\the\pst@cntd}
890 \fi
891 \ifx\PstGridThreeDHookNode\empty
892 \else
893 % \end{macrocode}
894 %
895 % Nodes drawing.
896 %
897 % \begin{macrocode}
898 \rput(\ia,\ib){\PstGridThreeDHookNode}
899 \fi}}}
900 % \end{macrocode}
901 % \end{macro}
902 %
903 % \subsection{Default hooks (empty)}
904 %
905 % \begin{macro}{\PstGridThreeDHookNode}
906 % \begin{macrocode}
907 \def\PstGridThreeDHookNode{}
908 % \end{macrocode}
909 % \end{macro}
910 %
911 % \begin{macro}{\PstGridThreeDHookXFace}
912 % \begin{macrocode}
913 \def\PstGridThreeDHookXFace{}
914 % \end{macrocode}
915 % \end{macro}
916 %
917 % \begin{macro}{\PstGridThreeDHookYFace}
918 % \begin{macrocode}
919 \def\PstGridThreeDHookYFace{}
920 % \end{macrocode}
921 % \end{macro}
922 %
923 % \begin{macro}{\PstGridThreeDHookZFace}
924 % \begin{macrocode}
925 \def\PstGridThreeDHookZFace{}
926 % \end{macrocode}
927 % \end{macro}
928 %
929 % For the end hook, we must avoid infinite recursion if the hook contain
930 % a \cs{PstGridThreeD} macro!
931 %
932 % \begin{macro}{\PstGridThreeDHookEnd}
933 % \begin{macrocode}
934 \def\PstGridThreeDHookEnd{}
935 % \end{macrocode}
936 % \end{macro}
937 %
938 % \begin{macro}{\PstGridThreeD@HookEnd}
939 % \begin{macrocode}
940 \def\PstGridThreeD@HookEnd{%
941 \def\PstGridThreeD@HookEnd{}%
942 \PstGridThreeDHookEnd}
943 % \end{macrocode}
944 % \end{macro}
945 %
946 % Default definition of a processor node.
947 %
948 % \begin{macro}{\PstGridThreeDNodeProcessor}
949 % \begin{macrocode}
950 \def\PstGridThreeDNodeProcessor#1{{%
951 \psset{unit=0.3}
952 \pspicture(-0.5,-0.5)(0.5,0.5)
953 \pscircle*[linecolor=#1]{0.5}
954 \pscircle*[linecolor=white]{0.2}
955 \endpspicture}}
956 % \end{macrocode}
957 % \end{macro}
958 %
959 % \subsection{Closing}
960 %
961 % Catcodes restoration.
962 %
963 % \begin{macrocode}
964 \catcode`\@=\PstAtCode\relax
965 % \end{macrocode}
966 %
967 % \begin{macrocode}
968 %</pst-gr3d>
969 % \end{macrocode}
970 %
971 % \Finale
972 %
973 \endinput
974 %%
975 %% End of file `pst-gr3d.dtx'