| 1 |
% \iffalse meta-comment, etc. |
| 2 |
%% |
| 3 |
%% Package `pst-ob3d.dtx' |
| 4 |
%% |
| 5 |
%% Denis Girou (CNRS/IDRIS - France) <[email protected]> |
| 6 |
%% Herbert Voss <[email protected]> |
| 7 |
%% |
| 8 |
%% Mar 24, 2020 |
| 9 |
%% |
| 10 |
%% This program can be redistributed and/or modified under the terms |
| 11 |
%% of the LaTeX Project Public License Distributed from CTAN archives |
| 12 |
%% in directory macros/latex/base/lppl.txt. |
| 13 |
%% |
| 14 |
%% DESCRIPTION: |
| 15 |
%% `pst-ob3d' is a PSTricks package to draw basic three dimensional |
| 16 |
%% objects with various customizations. |
| 17 |
%% |
| 18 |
% \fi |
| 19 |
% |
| 20 |
% \changes{v0.22}{2020/03/24}{Load pst-tools for random numbers} |
| 21 |
% \changes{v0.21}{2007/08/22}{Updated the style file} |
| 22 |
% \changes{v0.20}{2006/11/25}{First CTAN release} |
| 23 |
% \changes{v0.11 Beta}{2002/05/09}{Fourth packaged release.} |
| 24 |
% \changes{v0.1 Beta}{1994}{First beta version in 1994 (unpublished).} |
| 25 |
% |
| 26 |
% \DoNotIndex{\\,\^,\@} |
| 27 |
% \DoNotIndex{\@empty,\@ifnextchar,\@nameuse,\@ne,\@nil,\@tempa} |
| 28 |
% \DoNotIndex{\@undefined} |
| 29 |
% \DoNotIndex{\advance} |
| 30 |
% \DoNotIndex{\baselineskip,\begin,\bgroup} |
| 31 |
% \DoNotIndex{\c@CodelineNo,\catcode,\CodelineIndex,\count@,\csname} |
| 32 |
% \DoNotIndex{\def,\define@key,\divide,\DocInput,\documentclass,\DoNotIndex} |
| 33 |
% \DoNotIndex{\edef,\egroup,\else,\EnableCrossrefs,\end,\endcsname,\endgroup} |
| 34 |
% \DoNotIndex{\endinput} |
| 35 |
% \DoNotIndex{\expandafter} |
| 36 |
% \DoNotIndex{\fi,\filedate,\fileversion} |
| 37 |
% \DoNotIndex{\GetFileInfo,\global} |
| 38 |
% \DoNotIndex{\hbadness,\hbox,\hfuzz,\hspace} |
| 39 |
% \DoNotIndex{\if@inlabel,\ifcase,\ifdim,\ifnum,\ifx,\ignorespaces,\item} |
| 40 |
% \DoNotIndex{\input} |
| 41 |
% \DoNotIndex{\let,\llap,\long,\loop} |
| 42 |
% |
| 43 |
% \DoNotIndex{\m@cro@,\m@ne,\macro@cnt,\MacroTopsep,\makeatletter,\makeatother} |
| 44 |
% \DoNotIndex{\makelabel,\message,\multiply} |
| 45 |
% \DoNotIndex{\newif,\nobreak,\noexpand} |
| 46 |
% \DoNotIndex{\OnlyDescription,\or} |
| 47 |
% \DoNotIndex{\PrintMacroName,\PrintEnvName,\ProvidesPackage} |
| 48 |
% \DoNotIndex{\pspolygon,\psdots,\psframe,\psk@viewpoint,\psset} |
| 49 |
% \DoNotIndex{\pssetxlength,\pssetylength,\pssetzlength,\PstAtCode} |
| 50 |
% \DoNotIndex{\pst@cnth} |
| 51 |
% \DoNotIndex{\pst@dima,\pst@dimb,\pst@dimc,\pst@dimd,\pst@dimg,\pst@dimh} |
| 52 |
% \DoNotIndex{\pst@dimtonum,\pst@expandafter,\pst@getint,\pst@getcolor} |
| 53 |
% \DoNotIndex{\pst@tempa,\pst@tempb,\pst@tempc,\pst@tempd} |
| 54 |
% \DoNotIndex{\pst@tempe,\pst@tempf,\pst@tempg,\pst@temph} |
| 55 |
% \DoNotIndex{\PstObjectsThreeDLoaded,\PSTricksLoaded,\PSTthreeDLoaded} |
| 56 |
% \DoNotIndex{\psxunit,\psyunit} |
| 57 |
% \DoNotIndex{\RecordChanges,\repeat,\relax,\rput} |
| 58 |
% |
| 59 |
% \DoNotIndex{\saved@macroname,\setrannum,\space,\SpecialMainEnvIndex} |
| 60 |
% \DoNotIndex{\SpecialMainIndex,\string,\strut} |
| 61 |
% \DoNotIndex{\the,\ThreeDput,\topsep,\trivlist,\tw@} |
| 62 |
% \DoNotIndex{\usepackage} |
| 63 |
% \DoNotIndex{\vss,\vtop} |
| 64 |
% \DoNotIndex{\z@} |
| 65 |
% |
| 66 |
% \setcounter{IndexColumns}{2} |
| 67 |
% |
| 68 |
% \newcommand{\PstObjectsThreeDPackage}{`\textsf{pst-ob3d}'} |
| 69 |
% \newcommand{\PstThreeDPackage}{`\textsf{pst-3d}'} |
| 70 |
% \newcommand{\RandomPackage}{`\textsf{random}'} |
| 71 |
% |
| 72 |
% ^^A From ltugboat.cls |
| 73 |
% |
| 74 |
% ^^A Typeset the name of an environment |
| 75 |
% \providecommand\env[1]{\textsf{#1}} |
| 76 |
% \providecommand\clsname[1]{\textsf{#1}} |
| 77 |
% \providecommand\pkgname[1]{\textsf{#1}} |
| 78 |
% \providecommand\optname[1]{\textsf{#1}} |
| 79 |
% \providecommand\progname[1]{\textsf{#1}} |
| 80 |
% |
| 81 |
% ^^A A list of options for a package/class |
| 82 |
% \newenvironment{optlist}{\begin{description}% |
| 83 |
% \renewcommand\makelabel[1]{% |
| 84 |
% \descriptionlabel{\mdseries\optname{##1}}}% |
| 85 |
% \itemsep0.25\itemsep}% |
| 86 |
% {\end{description}} |
| 87 |
% |
| 88 |
% ^^A Utility macros |
| 89 |
% |
| 90 |
% |
| 91 |
% ^^A Example macros - adapted from the `fvrb-ex' package |
| 92 |
% ^^A --------------------------------------------------- |
| 93 |
% |
| 94 |
% ^^A Take care that we use here the four /?_W characters as escape |
| 95 |
% ^^A characters, so we can't use these characters in the examples! |
| 96 |
% |
| 97 |
% \makeatletter |
| 98 |
% |
| 99 |
% ^^A To highlight some verbatim sequences (comments, macro names, etc.) |
| 100 |
% \def\HLEmphasize#1{\textit{#1}} |
| 101 |
% \newcommand{\BS}{\texttt{\symbol{`\\}}} |
| 102 |
% \def\HLMacro#1{\BS{}def\HLMacro@i#1\@nil} |
| 103 |
% \def\HLMacro@i#1def#2\@nil{\HLReverse{#2}} |
| 104 |
% \def\HLReverse#1{{\setlength{\fboxsep}{1pt}\HLReverse@i{#1}}} |
| 105 |
% \def\HLReverse@i#1{\colorbox{black}{\textcolor{white}{\textbf{#1}}}} |
| 106 |
% |
| 107 |
% \newif\ifFVrbEx@Grid |
| 108 |
% \def\showgrid{\FVrbEx@Gridtrue} |
| 109 |
% \newpsobject{FVrbExGrid}{psgrid}{subgriddiv=0,griddots=10,gridlabels=7pt} |
| 110 |
% |
| 111 |
% \def\Example{\FV@Environment{}{Example}} |
| 112 |
% \def\endExample{% |
| 113 |
% \end{VerbatimOut} |
| 114 |
% \Below@Example{\input{\jobname.tmp}} |
| 115 |
% \endgroup} |
| 116 |
% |
| 117 |
% \def\CenterExample{\FV@Environment{}{Example}} |
| 118 |
% \def\endCenterExample{% |
| 119 |
% \end{VerbatimOut} |
| 120 |
% \begin{center} |
| 121 |
% \Below@Example{\input{\jobname.tmp}} |
| 122 |
% \end{center} |
| 123 |
% \endgroup} |
| 124 |
% |
| 125 |
% \def\SideBySideExample{\FV@Environment{}{Example}} |
| 126 |
% \def\endSideBySideExample{% |
| 127 |
% \end{VerbatimOut} |
| 128 |
% \SideBySide@Example{\input{\jobname.tmp}} |
| 129 |
% \endgroup} |
| 130 |
% |
| 131 |
% \def\PCenterExample{\FV@Environment{}{PExample}} |
| 132 |
% |
| 133 |
% \def\endPCenterExample{% |
| 134 |
% \end{VerbatimOut}% |
| 135 |
% \Below@Example{% |
| 136 |
% \begin{center} |
| 137 |
% \expandafter\pspicture\PstPicture@Size |
| 138 |
% \ifFVrbEx@Grid\FVrbExGrid\fi\relax |
| 139 |
% \input{\jobname.tmp}% |
| 140 |
% \endpspicture |
| 141 |
% \end{center}} |
| 142 |
% \endgroup} |
| 143 |
% |
| 144 |
% \def\PSideBySideExample{\FV@Environment{}{PExample}} |
| 145 |
% |
| 146 |
% \def\endPSideBySideExample{% |
| 147 |
% \end{VerbatimOut}% |
| 148 |
% \SideBySide@Example{% |
| 149 |
% \expandafter\pspicture\PstPicture@Size |
| 150 |
% \ifFVrbEx@Grid\vskip 5pt\fi |
| 151 |
% \input{\jobname.tmp}% |
| 152 |
% \endpspicture |
| 153 |
% \ifFVrbEx@Grid\vskip 5pt\fi |
| 154 |
% \smallskip}% |
| 155 |
% \endgroup} |
| 156 |
% |
| 157 |
% \def\FVB@Example{% |
| 158 |
% \begingroup |
| 159 |
% \FV@UseKeyValues |
| 160 |
% \parindent=0pt |
| 161 |
% \multiply\topsep\tw@ |
| 162 |
% \VerbatimEnvironment |
| 163 |
% \begin{VerbatimOut}[gobble=4,codes={\catcode`\W=12}]{\jobname.tmp}} |
| 164 |
% |
| 165 |
% \def\Below@Example#1{% |
| 166 |
% \VerbatimInput[gobble=0,commentchar=W,commandchars=/?_,frame=single, |
| 167 |
% numbers=left,numbersep=3pt]{\jobname.tmp} |
| 168 |
% \catcode`\%=14\relax |
| 169 |
% \catcode`\W=9\relax |
| 170 |
% ^^A We suppress the effect of the highlighting macros |
| 171 |
% \catcode`/=0\relax |
| 172 |
% \catcode`?=1\relax |
| 173 |
% \catcode`_=2\relax |
| 174 |
% \def\HLEmphasize##1{##1}% |
| 175 |
% \def\HLMacro##1{##1}% |
| 176 |
% \def\HLReverse##1{##1}% |
| 177 |
% #1 |
| 178 |
% \par} |
| 179 |
% |
| 180 |
% \def\SideBySide@Example#1{% |
| 181 |
% \vskip 1mm |
| 182 |
% \@tempdimb=\FV@XRightMargin |
| 183 |
% \advance\@tempdimb -5mm |
| 184 |
% \begin{minipage}[c]{\@tempdimb} |
| 185 |
% \fvset{xrightmargin=0pt} |
| 186 |
% \catcode`\%=14\relax |
| 187 |
% \catcode`\W=9\relax |
| 188 |
% ^^A We suppress the effect of the highlighting macros |
| 189 |
% \catcode`/=0\relax |
| 190 |
% \catcode`?=1\relax |
| 191 |
% \catcode`_=2\relax |
| 192 |
% \def\HLEmphasize##1{##1}% |
| 193 |
% \def\HLMacro##1{##1}% |
| 194 |
% \def\HLReverse##1{##1}% |
| 195 |
% #1 |
| 196 |
% \end{minipage}% |
| 197 |
% \@tempdimb=\textwidth |
| 198 |
% \advance\@tempdimb -\FV@XRightMargin |
| 199 |
% \advance\@tempdimb 5mm |
| 200 |
% \begin{minipage}[c]{\@tempdimb} |
| 201 |
% \VerbatimInput[gobble=0,commentchar=W,commandchars=/?_, |
| 202 |
% frame=single,numbers=left,numbersep=3pt, |
| 203 |
% xleftmargin=5mm,xrightmargin=0pt]{\jobname.tmp} |
| 204 |
% \end{minipage} |
| 205 |
% \vskip 1mm} |
| 206 |
% |
| 207 |
% \def\FVB@PExample{% |
| 208 |
% \begingroup |
| 209 |
% \FV@UseKeyValues |
| 210 |
% \FVB@PExample@i} |
| 211 |
% |
| 212 |
% \def\FVB@PExample@i(#1,#2){% |
| 213 |
% \@ifnextchar({\FVB@PExample@ii(#1,#2)}{\FVB@PExample@ii(0,0)(#1,#2)}} |
| 214 |
% |
| 215 |
% \def\FVB@PExample@ii(#1,#2)(#3,#4){% |
| 216 |
% \def\PstPicture@Size{(#1,#2)(#3,#4)}% |
| 217 |
% \parindent=0pt |
| 218 |
% \multiply\topsep\tw@ |
| 219 |
% \VerbatimEnvironment |
| 220 |
% \begin{VerbatimOut}[gobble=4,codes={\catcode`\W=12}]{\jobname.tmp}} |
| 221 |
% |
| 222 |
% \makeatother |
| 223 |
% |
| 224 |
% ^^A End of example macros from `fvrb-ex' |
| 225 |
% |
| 226 |
% ^^A For the possible index and changes log |
| 227 |
% \setlength{\columnseprule}{0.6pt} |
| 228 |
% |
| 229 |
% ^^A Beginning of the documentation itself |
| 230 |
% |
| 231 |
% \title{The \PstObjectsThreeDPackage{} package\\ |
| 232 |
% A PSTricks package\\ |
| 233 |
% for three dimensional basic objects} |
| 234 |
% \author{Denis \textsc{Girou}\thanks{CNRS/IDRIS --- |
| 235 |
% Centre National de la Recherche Scientifique / |
| 236 |
% Institut du D\'eveloppement et des Ressources en Informatique |
| 237 |
% Scientifique --- Orsay --- France --- |
| 238 |
% \protect\url{[email protected]}.} \and |
| 239 |
% Herbert Vo\ss\thanks{\protect\url{[email protected]} for the \texttt{CTAN} Version}} |
| 240 |
% \date{Version 0.22\\March 24, 2020} |
| 241 |
% |
| 242 |
% \maketitle |
| 243 |
% |
| 244 |
% \begin{abstract} |
| 245 |
% This package allow to draw basic three dimensional objects. Up to now |
| 246 |
% only cubes (which can be deformed to rectangular parallelipiped ones) and |
| 247 |
% dies (which are only a special kind of cubes) are defined. |
| 248 |
% \end{abstract} |
| 249 |
% |
| 250 |
% \tableofcontents |
| 251 |
% |
| 252 |
% \section{Introduction} |
| 253 |
% |
| 254 |
% \PstObjectsThreeDPackage{} define basic three dimensional objects. Up to |
| 255 |
% now only cubes of several kinds are defined (as this is the easiest thing to |
| 256 |
% do!), so the interest of this package is still limited... |
| 257 |
% |
| 258 |
% As usual, all the relevant PSTricks parameters can be use and few ones are |
| 259 |
% added specially for these 3d objects. |
| 260 |
% |
| 261 |
% You must take care that these objects are \emph{pure graphics} ones, that |
| 262 |
% is to say that they have no dimension (in any case, it would be very |
| 263 |
% difficult to compute their bounding boxes accurately, according to the user |
| 264 |
% point of vue chosen --- the \emph{viewpoint}). So, we have to compute their |
| 265 |
% sizes and to put these objects in a \texttt{pspicture} environment by |
| 266 |
% ourselves. |
| 267 |
% |
| 268 |
% \section{Usage} |
| 269 |
% |
| 270 |
% \subsection{Macros} |
| 271 |
% |
| 272 |
% Two macros are currently defined: \cs{PstCube} to draw a cube and |
| 273 |
% \cs{PstDie} to draw a die (which is only a cube with dots on it faces). |
| 274 |
% |
| 275 |
% \subsubsection{Cubes} |
| 276 |
% |
| 277 |
% \cs{PstCube} has three required parameters, respectively for the X, Y and |
| 278 |
% Z lengths, as we can distord the cubes to parallelipiped ones. |
| 279 |
% |
| 280 |
% \vspace{1mm} |
| 281 |
% \noindent% |
| 282 |
% \fbox{\cs{PstCube}\texttt{[optional\_parameters]\{X\_length\}\{Y\_length\}\{Z\_length\}}} |
| 283 |
% |
| 284 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 285 |
% \PstCube{1}{1}{1} |
| 286 |
% \end{PSideBySideExample} |
| 287 |
% |
| 288 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(1.4,2.5) |
| 289 |
% \PstCube{1}{2}{1.5} |
| 290 |
% \end{PSideBySideExample} |
| 291 |
% |
| 292 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(1.4,2.5) |
| 293 |
% \PstCube[linestyle=dashed]{1}{2}{1.5} |
| 294 |
% \end{PSideBySideExample} |
| 295 |
% |
| 296 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 297 |
% \PstCube[fillstyle=hlines]{1}{1}{1} |
| 298 |
% \end{PSideBySideExample} |
| 299 |
% |
| 300 |
% As special care is made to draw the faces in the right order, according to |
| 301 |
% the user point of view, to draw last the visible faces, we can use a solid |
| 302 |
% color for the faces and still got a correct drawing of the borders. |
| 303 |
% |
| 304 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(2,3.3) |
| 305 |
% \PstCube[fillstyle=solid,fillcolor=red]{1}{3}{2} |
| 306 |
% \end{PSideBySideExample} |
| 307 |
% |
| 308 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(2,3.3) |
| 309 |
% \PstCube[linestyle=dotted,fillstyle=solid,fillcolor=white] |
| 310 |
% {1}{3}{2} |
| 311 |
% \end{PSideBySideExample} |
| 312 |
% |
| 313 |
% The \texttt{unit} parameter can still be used and has for effect to |
| 314 |
% multiply each of the three dimensions by it. In fact the value for |
| 315 |
% \texttt{xunit} is used both for the X and Y directions, and the |
| 316 |
% \texttt{yunit} one for the Z direction. |
| 317 |
% |
| 318 |
% \begin{PCenterExample}(-1.5,0)(5.4,3.3) |
| 319 |
% \rput(0,0){\PstCube[fillstyle=solid,fillcolor=white]{2}{2}{2}} |
| 320 |
% \rput(4,0){\PstCube[unit=2,fillstyle=solid,fillcolor=white]{1}{1}{1}} |
| 321 |
% \end{PCenterExample} |
| 322 |
% |
| 323 |
% \begin{PCenterExample}(-1.5,0)(5.4,2.5) |
| 324 |
% \rput(0,0){\PstCube[fillstyle=solid,fillcolor=white]{2}{2}{1}} |
| 325 |
% \rput(4,0){\PstCube[xunit=2,fillstyle=solid,fillcolor=white]{1}{1}{1}} |
| 326 |
% \end{PCenterExample} |
| 327 |
% |
| 328 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(2.75,2.5) |
| 329 |
% \PstCube[fillstyle=solid,fillcolor=white]{1}{1}{2} |
| 330 |
% \rput(2,0){% |
| 331 |
% \PstCube[yunit=2,fillstyle=solid,fillcolor=white] |
| 332 |
% {1}{1}{1}} |
| 333 |
% \end{PSideBySideExample} |
| 334 |
% |
| 335 |
% We can of course use the \texttt{viewpoint} and \texttt{viewangle} |
| 336 |
% parameters of the \PstThreeDPackage{} package to change the user point of |
| 337 |
% vue. |
| 338 |
% |
| 339 |
% \begin{PCenterExample}(-1,-1.2)(16,3.5) |
| 340 |
% \rput(0,0){\PstCube{1}{3}{2}} |
| 341 |
% \rput(3,0){\PstCube[viewangle=20]{1}{3}{2}} |
| 342 |
% \rput(7.5,0){\PstCube[viewangle=-10]{1}{3}{2}} |
| 343 |
% \rput(10.5,0){\PstCube[viewpoint=1 -1 0.3]{1}{3}{2}} |
| 344 |
% \rput(13,0){\PstCube[viewpoint=1 1 1]{1}{3}{2}} |
| 345 |
% \end{PCenterExample} |
| 346 |
% |
| 347 |
% \subsubsection{Dies} |
| 348 |
% |
| 349 |
% \cs{PstDie} has no required parameters, as it must be a cube, so with |
| 350 |
% the same lengths in each direction. The \texttt{unit} parameter is enough |
| 351 |
% to change it size. Of course, only the visibles faces, according to the user |
| 352 |
% point of vue, are shown. |
| 353 |
% |
| 354 |
% \vspace{1mm} |
| 355 |
% \noindent% |
| 356 |
% \fbox{\cs{PstDie}\texttt{[optional\_parameters]}} |
| 357 |
% |
| 358 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 359 |
% \PstDie |
| 360 |
% \end{PSideBySideExample} |
| 361 |
% |
| 362 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.4,-0.4)(2.1,2.1) |
| 363 |
% \PstDie[unit=1.5,dotscale=3,viewangle=45] |
| 364 |
% \end{PSideBySideExample} |
| 365 |
% |
| 366 |
% \begin{PSideBySideExample}[xrightmargin=4cm](0,-0.2)(2.5,2.5) |
| 367 |
% \PstDie[unit=2,dotsize=0.25,linecolor=red,viewpoint=1 3 -1] |
| 368 |
% \end{PSideBySideExample} |
| 369 |
% |
| 370 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-1,0)(0.4,1.7) |
| 371 |
% \PstDie[fillstyle=solid,fillcolor=yellow, |
| 372 |
% viewpoint=0.4 -1 1] |
| 373 |
% \end{PSideBySideExample} |
| 374 |
% |
| 375 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-1.5,-0.5)(0,1.3) |
| 376 |
% \PstDie[fillstyle=solid,fillcolor=yellow, |
| 377 |
% viewpoint=-1 -1 -1] |
| 378 |
% \end{PSideBySideExample} |
| 379 |
% |
| 380 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-1.5,-0.5)(0,1.3) |
| 381 |
% \PstDie[fillstyle=solid,fillcolor=yellow,viewpoint=-1 -1 1] |
| 382 |
% \end{PSideBySideExample} |
| 383 |
% |
| 384 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,-0.9)(0.75,0.9) |
| 385 |
% \PstDie[fillstyle=solid,fillcolor=yellow,viewpoint=-1 1 1] |
| 386 |
% \end{PSideBySideExample} |
| 387 |
% |
| 388 |
% \begin{PCenterExample}(-0.8,-1.3)(14.7,1.8) |
| 389 |
% \psset{fillstyle=solid,fillcolor=yellow} |
| 390 |
% \multido{\iPos=0+2,\nViewPointZ=-2.1+0.5}{8}{% |
| 391 |
% \rput(\iPos,0){\PstDie[viewpoint=1 -1 \nViewPointZ]}} |
| 392 |
% \end{PCenterExample} |
| 393 |
% |
| 394 |
% \begin{PCenterExample}(-1.2,-0.5)(15,1.7) |
| 395 |
% \psset{fillstyle=solid,fillcolor=yellow} |
| 396 |
% \rput(0,0){\PstDie[viewpoint=-5 -1 1]} |
| 397 |
% \rput(2,0){\PstDie[viewpoint=-3 -1 1]} |
| 398 |
% \rput(4,0){\PstDie[viewpoint=-1 -1 1]} |
| 399 |
% \rput(6,0){\PstDie[viewpoint=-0.3 -1 1]} |
| 400 |
% \rput(8,0){\PstDie[viewpoint=0.3 -1 1]} |
| 401 |
% \rput(10,0){\PstDie[viewpoint=1 -1 1]} |
| 402 |
% \rput(12,0){\PstDie[viewpoint=3 -1 1]} |
| 403 |
% \rput(14,0){\PstDie[viewpoint=5 -1 1]} |
| 404 |
% \end{PCenterExample} |
| 405 |
% |
| 406 |
% \begin{PCenterExample}(-1,-0.5)(15.2,1.7) |
| 407 |
% \psset{fillstyle=solid,fillcolor=yellow} |
| 408 |
% \rput(0,0){\PstDie[viewpoint=1 -5 1]} |
| 409 |
% \rput(2,0){\PstDie[viewpoint=1 -3 1]} |
| 410 |
% \rput(4,0){\PstDie[viewpoint=1 -1 1]} |
| 411 |
% \rput(6,0){\PstDie[viewpoint=1 -0.3 1]} |
| 412 |
% \rput(8,0){\PstDie[viewpoint=1 0.3 1]} |
| 413 |
% \rput(10,0){\PstDie[viewpoint=1 1 1]} |
| 414 |
% \rput(12,0){\PstDie[viewpoint=1 3 1]} |
| 415 |
% \rput(14,0){\PstDie[viewpoint=1 5 1]} |
| 416 |
% \end{PCenterExample} |
| 417 |
% |
| 418 |
% \subsection{Parameters} |
| 419 |
% |
| 420 |
% \begin{optlist} |
| 421 |
% \item [PstDebug (integer)]: to obtain some internal debugging informations |
| 422 |
% --- here, a letter is printed at the center of each face, to help to |
| 423 |
% locate the various faces according to the user point of vue. It can take |
| 424 |
% the values 0 (no debug) or 1. |
| 425 |
% (\emph{Default:~0} --- no debugging informations). |
| 426 |
% \end{optlist} |
| 427 |
% |
| 428 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.4,0)(2.2,2.3) |
| 429 |
% \PstCube[PstDebug=1]{0.5}{3}{1} |
| 430 |
% \end{PSideBySideExample} |
| 431 |
% |
| 432 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-2.3,-0.2)(0,2.3) |
| 433 |
% \PstCube[PstDebug=1,viewpoint=-0.8 -1 1]{0.5}{3}{1} |
| 434 |
% \end{PSideBySideExample} |
| 435 |
% |
| 436 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-1.9,0)(0.4,2.5) |
| 437 |
% \PstCube[PstDebug=1,viewpoint=-0.8 1 -1]{0.5}{3}{1} |
| 438 |
% \end{PSideBySideExample} |
| 439 |
% |
| 440 |
% \begin{optlist} |
| 441 |
% \item [OnlyVisibleFaces (boolean)]: to draw only the (three) visible |
| 442 |
% faces, according to the user point of view |
| 443 |
% (\emph{Default:~false}). |
| 444 |
% \end{optlist} |
| 445 |
% |
| 446 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 447 |
% \PstCube[OnlyVisibleFaces=true]{1}{1}{1} |
| 448 |
% \end{PSideBySideExample} |
| 449 |
% |
| 450 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.8,0)(1.9,3.5) |
| 451 |
% \PstCube[PstDebug=1,OnlyVisibleFaces=true, |
| 452 |
% viewpoint=0.8 -1 1]{1}{3}{2} |
| 453 |
% \end{PSideBySideExample} |
| 454 |
% |
| 455 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-2.7,-0.4)(0,3) |
| 456 |
% \PstCube[PstDebug=1,OnlyVisibleFaces=true, |
| 457 |
% viewpoint=-0.8 -1 1]{1}{3}{2} |
| 458 |
% \end{PSideBySideExample} |
| 459 |
% |
| 460 |
% \begin{PSideBySideExample}[xrightmargin=4cm](0,-1.5)(2.7,2) |
| 461 |
% \PstCube[PstDebug=1,OnlyVisibleFaces=true, |
| 462 |
% viewpoint=0.8 1 1]{1}{3}{2} |
| 463 |
% \end{PSideBySideExample} |
| 464 |
% |
| 465 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-2.7,-0.4)(0,3.1) |
| 466 |
% \PstCube[PstDebug=1,OnlyVisibleFaces=true, |
| 467 |
% viewpoint=-0.8 -1 1]{1}{3}{2} |
| 468 |
% \end{PSideBySideExample} |
| 469 |
% |
| 470 |
% \begin{PSideBySideExample}[xrightmargin=4cm](0,-0.4)(2.7,3) |
| 471 |
% \PstCube[PstDebug=1,OnlyVisibleFaces=true, |
| 472 |
% viewpoint=0.8 1 -1]{1}{3}{2} |
| 473 |
% \end{PSideBySideExample} |
| 474 |
% |
| 475 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-1.9,0)(0.8,3.5) |
| 476 |
% \PstCube[PstDebug=1,OnlyVisibleFaces=true, |
| 477 |
% viewpoint=-0.8 1 -1]{1}{3}{2} |
| 478 |
% \end{PSideBySideExample} |
| 479 |
% |
| 480 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.8,-1.8)(1.9,1.7) |
| 481 |
% \PstCube[PstDebug=1,OnlyVisibleFaces=true, |
| 482 |
% viewpoint=0.8 -1 -1]{1}{3}{2} |
| 483 |
% \end{PSideBySideExample} |
| 484 |
% |
| 485 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-2.7,-1.5)(0,2) |
| 486 |
% \PstCube[PstDebug=1,OnlyVisibleFaces=true, |
| 487 |
% viewpoint=-0.8 -1 -1]{1}{3}{2} |
| 488 |
% \end{PSideBySideExample} |
| 489 |
% |
| 490 |
% \begin{optlist} |
| 491 |
% \item [Corners (boolean)]: to mark corners. This is mostly an aesthetics |
| 492 |
% effect, in fact mainly pleasant for dies\footnote{I only follow here an |
| 493 |
% idea first implemented by Manuel \textsc{Luque} in his own PSTricks macro |
| 494 |
% for dies.}. |
| 495 |
% (\emph{Default:~false}). |
| 496 |
% \end{optlist} |
| 497 |
% |
| 498 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(2.75,1.7) |
| 499 |
% \PstCube[Corners=true]{1}{1}{1} |
| 500 |
% \rput(2,0){% |
| 501 |
% \PstCube[OnlyVisibleFaces=true,Corners=true]{1}{1}{1}} |
| 502 |
% \end{PSideBySideExample} |
| 503 |
% |
| 504 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 505 |
% \PstCube[fillstyle=solid,fillcolor=green,Corners=true] |
| 506 |
% {1}{1}{1} |
| 507 |
% \end{PSideBySideExample} |
| 508 |
% |
| 509 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 510 |
% \PstDie[dotscale=1.5,fillstyle=solid,fillcolor=yellow, |
| 511 |
% Corners=true] |
| 512 |
% \end{PSideBySideExample} |
| 513 |
% |
| 514 |
% \begin{optlist} |
| 515 |
% \item [CornersLength (real)]: the length of the corners, when they are |
| 516 |
% shown. This value is multiplied by the unit values in each direction. |
| 517 |
% (\emph{Default:~0.15} --- it must rather be a number between 0~and~0.5, |
| 518 |
% otherwise there will not be any error but the results will look |
| 519 |
% strange...). |
| 520 |
% \end{optlist} |
| 521 |
% |
| 522 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 523 |
% \PstCube[fillstyle=solid,fillcolor=green, |
| 524 |
% Corners=true,CornersLength=0.25]{1}{1}{1} |
| 525 |
% \end{PSideBySideExample} |
| 526 |
% |
| 527 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 528 |
% \PstCube[OnlyVisibleFaces=true,Corners=true, |
| 529 |
% CornersLength=0.3]{1}{1}{1} |
| 530 |
% \end{PSideBySideExample} |
| 531 |
% |
| 532 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 533 |
% \PstCube[OnlyVisibleFaces=true,Corners=true, |
| 534 |
% CornersLength=0.5]{1}{1}{1} |
| 535 |
% \end{PSideBySideExample} |
| 536 |
% |
| 537 |
% \begin{optlist} |
| 538 |
% \item [CornersColor (color)]: the color of the corners |
| 539 |
% (\emph{Default:~black}). |
| 540 |
% \end{optlist} |
| 541 |
% |
| 542 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-1.5,0)(2.2,2.8) |
| 543 |
% \PstCube[fillstyle=solid,fillcolor=cyan,Corners=true, |
| 544 |
% CornersColor=blue]{2}{3}{1} |
| 545 |
% \end{PSideBySideExample} |
| 546 |
% |
| 547 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-2.6,-1.5)(0,1.9) |
| 548 |
% \PstCube[viewpoint=-0.8 -1 -1, |
| 549 |
% Corners=true,CornersColor=red,CornersLength=0.2, |
| 550 |
% fillstyle=solid,fillcolor=green]{1}{3}{2} |
| 551 |
% \end{PSideBySideExample} |
| 552 |
% |
| 553 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-1.5,0.2)(2.2,2.6) |
| 554 |
% \PstCube[fillstyle=solid,fillcolor=yellow, |
| 555 |
% Corners=true,CornersColor=magenta, |
| 556 |
% CornersLength=0.4]{2}{3}{1} |
| 557 |
% \end{PSideBySideExample} |
| 558 |
% |
| 559 |
% \begin{PCenterExample}(-1,0)(11,1.7) |
| 560 |
% \psset{fillstyle=solid,fillcolor=yellow,Corners=true,CornersColor=red} |
| 561 |
% \multido{\iPos=0+2,\nCornersLength=0+0.1}{6}{% |
| 562 |
% \rput(\iPos,0){\PstCube[CornersLength=\nCornersLength]{1}{1}{1}}} |
| 563 |
% \end{PCenterExample} |
| 564 |
% |
| 565 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 566 |
% \PstDie[dotscale=1.5,fillstyle=solid,fillcolor=yellow, |
| 567 |
% Corners=true] |
| 568 |
% \end{PSideBySideExample} |
| 569 |
% |
| 570 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.3,0)(1.2,1.7) |
| 571 |
% \PstDie[dotscale=1.5,fillstyle=solid,fillcolor=yellow, |
| 572 |
% viewangle=30,Corners=true,CornersColor=red] |
| 573 |
% \end{PSideBySideExample} |
| 574 |
% |
| 575 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 576 |
% \PstDie[dotscale=1.5,fillstyle=solid,fillcolor=yellow, |
| 577 |
% Corners=true,CornersColor=red,CornersLength=0.2] |
| 578 |
% \end{PSideBySideExample} |
| 579 |
% |
| 580 |
% \begin{optlist} |
| 581 |
% \item [RandomFaces (boolean)]: to generate random faces. This has only a |
| 582 |
% meaning for dies, to simulate a throw of them. The hazard is managed by |
| 583 |
% the \RandomPackage{} package from Donald \textsc{Arseneau}. The random |
| 584 |
% seed is set by using the time when the compilation occur. But take care |
| 585 |
% that \TeX{} allow to access only to minutes and not to microseconds, so |
| 586 |
% several consecutive usages of this parameter will give the same behavior, |
| 587 |
% and no hazard at all... To force it, we must use the \cs{randomi} macro, |
| 588 |
% to initialize the random seed to an arbitrary integer value (see the |
| 589 |
% documentation of the \RandomPackage{} package). |
| 590 |
% (\emph{Default:~false}). |
| 591 |
% \end{optlist} |
| 592 |
% |
| 593 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,1.7) |
| 594 |
% \PstDie[dotscale=2,fillstyle=solid,fillcolor=cyan, |
| 595 |
% RandomFaces=true] |
| 596 |
% \end{PSideBySideExample} |
| 597 |
% |
| 598 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.75,0)(0.75,2) |
| 599 |
% \randomi=12345 |
| 600 |
% \PstDie[dotscale=1.5,fillstyle=solid,fillcolor=magenta, |
| 601 |
% Corners=true,CornersColor=yellow,RandomFaces=true] |
| 602 |
% \end{PSideBySideExample} |
| 603 |
% |
| 604 |
% \subsection{Hooks} |
| 605 |
% |
| 606 |
% Twelve hooks can be used, to put arbitrary stuff on the faces. Six hooks |
| 607 |
% allow to put some material on a specified position (by default in the point |
| 608 |
% \texttt{(0,0)} of the face) and six other put it on the center of the faces, |
| 609 |
% according of the lengths in each direction. |
| 610 |
% |
| 611 |
% The name of these hooks are \cs{PstObjectsThreeDFace}\emph{Letter} and |
| 612 |
% \cs{PstObjectsThreeDFaceCenter}\emph{Letter} (with \emph{Letter} being a |
| 613 |
% letter between \textbf{A} and \textbf{F}). |
| 614 |
% |
| 615 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.6,-0.1)(0.9,1.8) |
| 616 |
% \def\PstObjectsThreeDFaceC{% |
| 617 |
% \psframe[fillstyle=solid,fillcolor=blue](1,1)} |
| 618 |
% \PstCube[viewpoint=0.6 -0.4 1]{1}{1}{1} |
| 619 |
% \end{PSideBySideExample} |
| 620 |
% |
| 621 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-0.6,-0.3)(0.9,1.8) |
| 622 |
% \def\PstObjectsThreeDFaceA{\rput(0.5,-0.5){\LARGE X}} |
| 623 |
% \def\PstObjectsThreeDFaceB{\rput(0.5,-0.5){\LARGE Y}} |
| 624 |
% \PstCube[viewpoint=0.6 -0.4 1]{1}{1}{1} |
| 625 |
% \end{PSideBySideExample} |
| 626 |
% |
| 627 |
% \begin{PCenterExample}(-0.6,-0.5)(9,3.1) |
| 628 |
% \psset{viewpoint=0.6 -0.4 1} |
| 629 |
% \def\PstObjectsThreeDFaceA{\LARGE X} |
| 630 |
% \def\PstObjectsThreeDFaceB{\rput(0.5,0.5){\LARGE Y}} |
| 631 |
% \rput(0,0){\PstCube{1}{1}{1}} |
| 632 |
% \def\PstObjectsThreeDFaceCenterC{\LARGE\textcolor{red}{\textbf{1}}} |
| 633 |
% \rput(3,0){\PstCube{3}{1}{1}} |
| 634 |
% \rput(6,0){\PstCube[viewpoint=0.8 1 1]{3}{1}{1}} |
| 635 |
% \end{PCenterExample} |
| 636 |
% |
| 637 |
% \section{Examples} |
| 638 |
% |
| 639 |
% We give here some more advanced examples. |
| 640 |
% |
| 641 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-1.5,0)(1.5,6) |
| 642 |
% \psset{fillstyle=solid} |
| 643 |
% \PstCube[fillcolor=green]{2}{2}{2} |
| 644 |
% \PstCube[fillcolor=red](-0.2,0.2,2){1.6}{1.6}{1.6} |
| 645 |
% \PstCube[fillcolor=yellow](-0.4,0.4,3.6){1.2}{1.2}{1.2} |
| 646 |
% \PstCube[fillcolor=cyan](-0.6,0.6,4.8){0.8}{0.8}{0.8} |
| 647 |
% \PstCube[fillcolor=magenta](-0.8,0.8,5.6){0.4}{0.4}{0.4} |
| 648 |
% \end{PSideBySideExample} |
| 649 |
% |
| 650 |
% \begin{PSideBySideExample}[xrightmargin=4cm](-1.5,0)(1.5,8.5) |
| 651 |
% \psset{unit=2,fillstyle=solid} |
| 652 |
% \def\PstObjectsThreeDFaceCenterA{\Huge\textbf{D}}% |
| 653 |
% \def\PstObjectsThreeDFaceCenterB{\Huge\textbf{L}}% |
| 654 |
% \PstCube[fillcolor=magenta]{1}{1}{1} |
| 655 |
% \def\PstObjectsThreeDFaceCenterA{\Huge\textbf{O}}% |
| 656 |
% \def\PstObjectsThreeDFaceCenterB{\Huge\textbf{R}}% |
| 657 |
% \PstCube[fillcolor=yellow](0,0,1){1}{1}{1} |
| 658 |
% \def\PstObjectsThreeDFaceCenterA{\Huge\textbf{O}}% |
| 659 |
% \def\PstObjectsThreeDFaceCenterB{\Huge\textbf{I}}% |
| 660 |
% \PstCube[fillcolor=cyan](0,0,2){1}{1}{1} |
| 661 |
% \def\PstObjectsThreeDFaceCenterA{% |
| 662 |
% \Huge\textcolor{white}{\textbf{G}}}% |
| 663 |
% \let\PstObjectsThreeDFaceCenterB |
| 664 |
% \PstObjectsThreeDFaceCenterA |
| 665 |
% \PstCube[fillcolor=blue](0,0,3){1}{1}{1} |
| 666 |
% \end{PSideBySideExample} |
| 667 |
% |
| 668 |
% \begin{PCenterExample}(0,-5)(17,5) |
| 669 |
% \definecolor{PaleGreen}{rgb}{0.6,0.98,0.6} |
| 670 |
% \psset{unit=2} |
| 671 |
% \ThreeDput{% |
| 672 |
% \psframe[fillstyle=solid,fillcolor=PaleGreen](6,6) |
| 673 |
% \psgrid[subgriddiv=0,gridlabels=0,griddots=5](6,6)} |
| 674 |
% \psset{fillstyle=solid,dotscale=3.5,RandomFaces=true,Corners=true} |
| 675 |
% \randomi=123817 |
| 676 |
% \PstDie[fillcolor=yellow](1,3,0) |
| 677 |
% \randomi=271354 |
| 678 |
% \PstDie[fillcolor=cyan,viewpoint=1 0.3 1,CornersColor=blue](0.3,1.5,0) |
| 679 |
% \randomi=93850516 |
| 680 |
% \PstDie[fillcolor=blue,linecolor=white,viewpoint=1 -0.5 1,CornersColor=cyan] |
| 681 |
% (3,3,0) |
| 682 |
% \randomi=8873165 |
| 683 |
% \PstDie[fillcolor=red,linecolor=white,viewpoint=1 -0.2 1,CornersColor=yellow] |
| 684 |
% (2,5,0) |
| 685 |
% \end{PCenterExample} |
| 686 |
% |
| 687 |
% |
| 688 |
% \StopEventually{} |
| 689 |
% |
| 690 |
% ^^A .................... End of the documentation part .................... |
| 691 |
% |
| 692 |
% \section{Driver file} |
| 693 |
% |
| 694 |
% The next bit of code contains the documentation driver file for \TeX{}, |
| 695 |
% i.e., the file that will produce the documentation you are currently |
| 696 |
% reading. It will be extracted from this file by the \texttt{docstrip} |
| 697 |
% program. |
| 698 |
% |
| 699 |
% \begin{macrocode} |
| 700 |
%<*driver> |
| 701 |
\documentclass{ltxdoc} |
| 702 |
\GetFileInfo{pst-ob3d.dtx} |
| 703 |
\usepackage{fancyvrb,url} |
| 704 |
\usepackage[dvips]{geometry} |
| 705 |
\usepackage{pstricks} |
| 706 |
\usepackage{pst-ob3d} |
| 707 |
\usepackage{multido} |
| 708 |
\EnableCrossrefs |
| 709 |
\CodelineIndex |
| 710 |
\RecordChanges |
| 711 |
%\OnlyDescription % Comment it for implementation details |
| 712 |
\hbadness=7000 % Over and under full box warnings |
| 713 |
\hfuzz=3pt |
| 714 |
% |
| 715 |
% To redefine the format used to print the macro names, |
| 716 |
% which was not well adapted to very long names like the ones we used |
| 717 |
\makeatletter |
| 718 |
\long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist |
| 719 |
\edef\saved@macroname{\string#2}% |
| 720 |
% D.G. modification begin - Dec. 15, 2000 |
| 721 |
% \def\makelabel##1{\llap{##1}}% |
| 722 |
\def\makelabel##1{\hspace{-2cm}##1}% |
| 723 |
% D.G. modification end |
| 724 |
\if@inlabel |
| 725 |
\let\@tempa\@empty \count@\macro@cnt |
| 726 |
\loop \ifnum\count@>\z@ |
| 727 |
\edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat |
| 728 |
\edef\makelabel##1{\llap{\vtop to\baselineskip |
| 729 |
{\@tempa\hbox{##1}\vss}}}% |
| 730 |
\advance \macro@cnt \@ne |
| 731 |
\else \macro@cnt\@ne \fi |
| 732 |
\edef\@tempa{\noexpand\item[% |
| 733 |
#1% |
| 734 |
\noexpand\PrintMacroName |
| 735 |
\else |
| 736 |
\noexpand\PrintEnvName |
| 737 |
\fi |
| 738 |
{\string#2}]}% |
| 739 |
\@tempa |
| 740 |
\global\advance\c@CodelineNo\@ne |
| 741 |
#1% |
| 742 |
\SpecialMainIndex{#2}\nobreak |
| 743 |
\DoNotIndex{#2}% |
| 744 |
\else |
| 745 |
\SpecialMainEnvIndex{#2}\nobreak |
| 746 |
\fi |
| 747 |
\global\advance\c@CodelineNo\m@ne |
| 748 |
\ignorespaces} |
| 749 |
\makeatother |
| 750 |
% |
| 751 |
\begin{document} |
| 752 |
\DocInput{pst-ob3d.dtx} |
| 753 |
\end{document} |
| 754 |
%</driver> |
| 755 |
% \end{macrocode} |
| 756 |
% |
| 757 |
% \section{\PstObjectsThreeDPackage{} \LaTeX{} wrapper} |
| 758 |
% |
| 759 |
% \begin{macrocode} |
| 760 |
%<*latex-wrapper> |
| 761 |
\RequirePackage{pstricks} |
| 762 |
\ProvidesPackage{pst-ob3d}[2006/11/25 package wrapper for |
| 763 |
pst-ob3d.tex (hv)] |
| 764 |
\input{pst-ob3d.tex} |
| 765 |
\ProvidesFile{pst-ob3d.tex} |
| 766 |
[\filedate\space v\fileversion\space `PST-ob3d' (dg,hv)] |
| 767 |
%</latex-wrapper> |
| 768 |
% \end{macrocode} |
| 769 |
% |
| 770 |
% \section{\PstObjectsThreeDPackage{} code} |
| 771 |
% |
| 772 |
% \begin{macrocode} |
| 773 |
%<*pst-ob3d> |
| 774 |
% \end{macrocode} |
| 775 |
% |
| 776 |
% \subsection{Preambule} |
| 777 |
% |
| 778 |
% Who we are. |
| 779 |
% |
| 780 |
% \begin{macrocode} |
| 781 |
\def\fileversion{0.22} |
| 782 |
\def\filedate{2020/03/24} |
| 783 |
\message{`Pst-Objects3d' v\fileversion, \filedate\space (DG,hv)} |
| 784 |
\csname PstObjectsThreeDLoaded\endcsname |
| 785 |
\let\PstObjectsThreeDLoaded\endinput |
| 786 |
% \end{macrocode} |
| 787 |
% |
| 788 |
% Require the PSTricks, `\textsf{pst-3d}', and `\textsf{pst-xkey}' packages. |
| 789 |
% |
| 790 |
% \begin{macrocode} |
| 791 |
\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi |
| 792 |
\ifx\PSTricksLoaded\endinput\else \input pstricks.tex\fi |
| 793 |
\ifx\PSTthreeDLoaded\endinput\else\input pst-3d.tex\fi |
| 794 |
\ifx\PSTtoolsLoaded\endinput\else \input pst-tools \fi |
| 795 |
% \end{macrocode} |
| 796 |
% |
| 797 |
% Catcodes changes. |
| 798 |
% |
| 799 |
% \begin{macrocode} |
| 800 |
\edef\PstAtCode{\the\catcode`\@} |
| 801 |
\catcode`\@=11\relax |
| 802 |
% \end{macrocode} |
| 803 |
% |
| 804 |
% \subsection{Definition of the parameters} |
| 805 |
% |
| 806 |
% Add the family name to the key list. |
| 807 |
% \begin{macrocode} |
| 808 |
\pst@addfams{pst-ob3d} |
| 809 |
% \end{macrocode} |
| 810 |
% \texttt{PstDebug} is for internal debugging purposes (here letters will be |
| 811 |
% printed on the faces). This option is alread defined in the basic PSTricks |
| 812 |
% package |
| 813 |
% |
| 814 |
% \texttt{OnlyVisibleFaces} to show only the visible faces. |
| 815 |
% |
| 816 |
% \begin{macrocode} |
| 817 |
\define@boolkey[psset]{pst-ob3d}[PstObjectsThreeD@]{OnlyVisibleFaces}[true]{} |
| 818 |
% \end{macrocode} |
| 819 |
% |
| 820 |
% \texttt{RandomFaces} to define randomly the faces of a die, using the |
| 821 |
% \RandomPackage{} package. |
| 822 |
% |
| 823 |
% \begin{macrocode} |
| 824 |
\define@boolkey[psset]{pst-ob3d}[PstObjectsThreeD@]{RandomFaces}[true]{} |
| 825 |
% \end{macrocode} |
| 826 |
% |
| 827 |
% \texttt{Corners} to draw corners. |
| 828 |
% |
| 829 |
% \begin{macrocode} |
| 830 |
\define@boolkey[psset]{pst-ob3d}[PstObjectsThreeD@]{Corners}[true]{} |
| 831 |
% \end{macrocode} |
| 832 |
% |
| 833 |
% \texttt{CornersColor} to choose the color of the corners. |
| 834 |
% |
| 835 |
% \begin{macrocode} |
| 836 |
\define@key[psset]{pst-ob3d}{CornersColor}{\def\PstObjectsThreeD@CornersColor{#1}} |
| 837 |
% \end{macrocode} |
| 838 |
% |
| 839 |
% \texttt{CornersLength} to choose the length of the corners. |
| 840 |
% |
| 841 |
% \begin{macrocode} |
| 842 |
\define@key[psset]{pst-ob3d}{CornersLength}{% |
| 843 |
\def\PstObjectsThreeD@CornersLength{#1}% |
| 844 |
\def\PstObjectsThreeD@CornersLengthTmpA{#1}% |
| 845 |
\def\PstObjectsThreeD@CornersLengthTmpB{#1}} |
| 846 |
% \end{macrocode} |
| 847 |
% |
| 848 |
% Next, we set the default values for all these new parameters. |
| 849 |
% |
| 850 |
% \begin{macrocode} |
| 851 |
\psset[pst-ob3d]{OnlyVisibleFaces=false,RandomFaces=false, |
| 852 |
Corners=false,CornersColor=black,CornersLength=0.15} |
| 853 |
% \end{macrocode} |
| 854 |
% |
| 855 |
% \subsection{Cube definition} |
| 856 |
% |
| 857 |
% \begin{macro}{\PstCube} |
| 858 |
% \begin{macrocode} |
| 859 |
\def\PstCube{\@ifnextchar[{\PstCube@i}{\PstCube@i[]}} |
| 860 |
% \end{macrocode} |
| 861 |
% \end{macro} |
| 862 |
% |
| 863 |
% \begin{macro}{\PstCube@i} |
| 864 |
% \begin{macrocode} |
| 865 |
\def\PstCube@i[#1]{\@ifnextchar({\PstCube@ii[#1]}{\PstCube@ii[#1](0,0,0)}} |
| 866 |
% \end{macrocode} |
| 867 |
% \end{macro} |
| 868 |
% |
| 869 |
% \begin{macro}{\PstCube@ii} |
| 870 |
% \begin{macrocode} |
| 871 |
\def\PstCube@ii[#1](#2,#3,#4)#5#6#7{{% |
| 872 |
% \end{macrocode} |
| 873 |
% |
| 874 |
% We force ``\texttt{dimen=middle}''. |
| 875 |
% |
| 876 |
% \begin{macrocode} |
| 877 |
\psset{dimen=middle}% |
| 878 |
% \end{macrocode} |
| 879 |
% |
| 880 |
% Then we set the local changes of parameters. |
| 881 |
% |
| 882 |
% \begin{macrocode} |
| 883 |
\psset{#1}% |
| 884 |
% \end{macrocode} |
| 885 |
% |
| 886 |
% For debugging purposes, we can require to print letters centered on the |
| 887 |
% faces. |
| 888 |
% |
| 889 |
% \begin{macrocode} |
| 890 |
\ifnum\Pst@Debug=\@ne |
| 891 |
\def\PstObjectsThreeDFaceCenterA{A}% |
| 892 |
\def\PstObjectsThreeDFaceCenterB{B}% |
| 893 |
\def\PstObjectsThreeDFaceCenterC{C}% |
| 894 |
\def\PstObjectsThreeDFaceCenterD{D}% |
| 895 |
\def\PstObjectsThreeDFaceCenterE{E}% |
| 896 |
\def\PstObjectsThreeDFaceCenterF{F}% |
| 897 |
\fi |
| 898 |
% \end{macrocode} |
| 899 |
% |
| 900 |
% We get the signs of the viewpoint coordinates (which are wrong by |
| 901 |
% themselves). This is necessary because the order of the drawing of the faces |
| 902 |
% must change according to the viewpoint, to hidden the non visible faces. |
| 903 |
% |
| 904 |
% \begin{macrocode} |
| 905 |
\pst@expandafter\psget@@viewpoint\psk@viewpoint {} {} {} \@nil |
| 906 |
% \end{macrocode} |
| 907 |
% |
| 908 |
% If corners must be shown, we will draw octogons, otherwise frames. |
| 909 |
% |
| 910 |
% \begin{macrocode} |
| 911 |
\ifPstObjectsThreeD@Corners |
| 912 |
\let\PstObjectsThreeD@Shape\PstObjectsThreeD@Octogon |
| 913 |
\else |
| 914 |
\let\PstObjectsThreeD@Shape\psframe |
| 915 |
\fi |
| 916 |
% \end{macrocode} |
| 917 |
% |
| 918 |
% According to the viewpoint, we draw in the right order the faces (three |
| 919 |
% ones when we must show only the visible ones, six otherwise). |
| 920 |
% |
| 921 |
% \begin{macrocode} |
| 922 |
\ifdim\pst@dimc>\z@ |
| 923 |
\ifdim\pst@dima>\z@ |
| 924 |
\ifdim\pst@dimb>\z@ |
| 925 |
% \end{macrocode} |
| 926 |
% |
| 927 |
% Case where $x > 0$ ; $y > 0$ ; $z > 0$ |
| 928 |
% |
| 929 |
% \begin{macrocode} |
| 930 |
\PstCube@DrawFaces{A}{E}{C}{B}{D}{F}{(#2,#3,#4)}{(#5,#6,#7)}% |
| 931 |
% \end{macrocode} |
| 932 |
% |
| 933 |
% \begin{macrocode} |
| 934 |
\else |
| 935 |
% \end{macrocode} |
| 936 |
% |
| 937 |
% Case where $x > 0$ ; $y < 0$ ; $z > 0$ |
| 938 |
% |
| 939 |
% \begin{macrocode} |
| 940 |
\PstCube@DrawFaces{E}{D}{C}{A}{B}{F}{(#2,#3,#4)}{(#5,#6,#7)}% |
| 941 |
% \end{macrocode} |
| 942 |
% |
| 943 |
% \begin{macrocode} |
| 944 |
\fi |
| 945 |
\else |
| 946 |
\ifdim\pst@dimb>\z@ |
| 947 |
% \end{macrocode} |
| 948 |
% |
| 949 |
% Case where $x < 0$ ; $y > 0$ ; $z > 0$ |
| 950 |
% |
| 951 |
% \begin{macrocode} |
| 952 |
\PstCube@DrawFaces{A}{B}{C}{E}{D}{F}{(#2,#3,#4)}{(#5,#6,#7)}% |
| 953 |
% \end{macrocode} |
| 954 |
% |
| 955 |
% \begin{macrocode} |
| 956 |
\else |
| 957 |
% \end{macrocode} |
| 958 |
% |
| 959 |
% Case where $x < 0$ ; $y < 0$ ; $z > 0$ |
| 960 |
% |
| 961 |
% \begin{macrocode} |
| 962 |
\PstCube@DrawFaces{D}{B}{C}{E}{A}{F}{(#2,#3,#4)}{(#5,#6,#7)}% |
| 963 |
% \end{macrocode} |
| 964 |
% |
| 965 |
% \begin{macrocode} |
| 966 |
\fi |
| 967 |
\fi |
| 968 |
\else |
| 969 |
\ifdim\pst@dima>\z@ |
| 970 |
\ifdim\pst@dimb>\z@ |
| 971 |
% \end{macrocode} |
| 972 |
% |
| 973 |
% Case where $x > 0$ ; $y > 0$ ; $z < 0$ |
| 974 |
% |
| 975 |
% \begin{macrocode} |
| 976 |
\PstCube@DrawFaces{B}{D}{C}{A}{E}{F}{(#2,#3,#4)}{(#5,#6,#7)}% |
| 977 |
% \end{macrocode} |
| 978 |
% |
| 979 |
% \begin{macrocode} |
| 980 |
\else |
| 981 |
% \end{macrocode} |
| 982 |
% |
| 983 |
% Case where $x > 0$ ; $y < 0$ ; $z < 0$ |
| 984 |
% |
| 985 |
% \begin{macrocode} |
| 986 |
\PstCube@DrawFaces{A}{B}{C}{E}{D}{F}{(#2,#3,#4)}{(#5,#6,#7)}% |
| 987 |
% \end{macrocode} |
| 988 |
% |
| 989 |
% \begin{macrocode} |
| 990 |
\fi |
| 991 |
\else |
| 992 |
\ifdim\pst@dimb>\z@ |
| 993 |
% \end{macrocode} |
| 994 |
% |
| 995 |
% Case where $x < 0$ ; $y > 0$ ; $z < 0$ |
| 996 |
% |
| 997 |
% \begin{macrocode} |
| 998 |
\PstCube@DrawFaces{D}{E}{C}{A}{B}{F}{(#2,#3,#4)}{(#5,#6,#7)}% |
| 999 |
% \end{macrocode} |
| 1000 |
% |
| 1001 |
% \begin{macrocode} |
| 1002 |
\else |
| 1003 |
% \end{macrocode} |
| 1004 |
% |
| 1005 |
% Case where $x < 0$ ; $y > 0$ ; $z < 0$ |
| 1006 |
% |
| 1007 |
% \begin{macrocode} |
| 1008 |
\PstCube@DrawFaces{E}{A}{C}{D}{B}{F}{(#2,#3,#4)}{(#5,#6,#7)}% |
| 1009 |
% \end{macrocode} |
| 1010 |
% |
| 1011 |
% \begin{macrocode} |
| 1012 |
\fi |
| 1013 |
\fi |
| 1014 |
\fi}} |
| 1015 |
% \end{macrocode} |
| 1016 |
% \end{macro} |
| 1017 |
% |
| 1018 |
% \subsection{Die definition} |
| 1019 |
% |
| 1020 |
% \begin{macro}{\PstDie} |
| 1021 |
% \begin{macrocode} |
| 1022 |
\def\PstDie{\@ifnextchar[{\PstDie@i}{\PstDie@i[]}} |
| 1023 |
% \end{macrocode} |
| 1024 |
% \end{macro} |
| 1025 |
% |
| 1026 |
% \begin{macro}{\PstDie@i} |
| 1027 |
% \begin{macrocode} |
| 1028 |
\def\PstDie@i[#1]{\@ifnextchar({\PstDie@ii[#1]}{\PstDie@ii[#1](0,0,0)}} |
| 1029 |
% \end{macrocode} |
| 1030 |
% \end{macro} |
| 1031 |
% |
| 1032 |
% \begin{macro}{\PstDie@ii} |
| 1033 |
% \begin{macrocode} |
| 1034 |
\def\PstDie@ii[#1](#2,#3,#4){{% |
| 1035 |
% \end{macrocode} |
| 1036 |
% |
| 1037 |
% We force ``\texttt{dimen=middle}''. |
| 1038 |
% |
| 1039 |
% \begin{macrocode} |
| 1040 |
\psset{dimen=middle}% |
| 1041 |
% \end{macrocode} |
| 1042 |
% |
| 1043 |
% We set the local changes of parameters. |
| 1044 |
% |
| 1045 |
% \begin{macrocode} |
| 1046 |
\psset{#1}% |
| 1047 |
% \end{macrocode} |
| 1048 |
% |
| 1049 |
% A die is only a cube where the six faces have dots between 1 and 6. |
| 1050 |
% |
| 1051 |
% \begin{macrocode} |
| 1052 |
\ifPstObjectsThreeD@RandomFaces |
| 1053 |
% \end{macrocode} |
| 1054 |
% |
| 1055 |
% First the case where the faces are defined randomly. |
| 1056 |
% |
| 1057 |
% \begin{macrocode} |
| 1058 |
\setrannum{\pst@cnth}{1}{6}% |
| 1059 |
\PstDie@Letter{\pst@cnth}{\@tempa}% |
| 1060 |
\expandafter\def\csname PstObjectsThreeDFace\@tempa\endcsname{% |
| 1061 |
\psdots(.5,.5)}% |
| 1062 |
\PstDie@Letter{\pst@cnth}{\@tempa}% |
| 1063 |
\expandafter\def\csname PstObjectsThreeDFace\@tempa\endcsname{% |
| 1064 |
\psdots(.2,.2)(.8,.8)}% |
| 1065 |
\PstDie@Letter{\pst@cnth}{\@tempa}% |
| 1066 |
\expandafter\def\csname PstObjectsThreeDFace\@tempa\endcsname{% |
| 1067 |
\psdots(.2,.2)(.5,.5)(.8,.8)}% |
| 1068 |
\PstDie@Letter{\pst@cnth}{\@tempa}% |
| 1069 |
\expandafter\def\csname PstObjectsThreeDFace\@tempa\endcsname{% |
| 1070 |
\psdots(.2,.2)(.2,.5)(.2,.8)(.8,.2)(.8,.5)(.8,.8)}% |
| 1071 |
\PstDie@Letter{\pst@cnth}{\@tempa}% |
| 1072 |
\expandafter\def\csname PstObjectsThreeDFace\@tempa\endcsname{% |
| 1073 |
\psdots(.2,.2)(.2,.8)(.5,.5)(.8,.2)(.8,.8)}% |
| 1074 |
\PstDie@Letter{\pst@cnth}{\@tempa}% |
| 1075 |
\expandafter\def\csname PstObjectsThreeDFace\@tempa\endcsname{% |
| 1076 |
\psdots(.2,.2)(.2,.8)(.8,.2)(.8,.8)}% |
| 1077 |
% \end{macrocode} |
| 1078 |
% |
| 1079 |
% \begin{macrocode} |
| 1080 |
\else |
| 1081 |
% \end{macrocode} |
| 1082 |
% |
| 1083 |
% Then the case where the faces are defined fixedly (the face ``4'' will be |
| 1084 |
% above). |
| 1085 |
% |
| 1086 |
% \begin{macrocode} |
| 1087 |
\def\PstObjectsThreeDFaceA{\psdots(.5,.5)}% |
| 1088 |
\def\PstObjectsThreeDFaceB{\psdots(.2,.2)(.8,.8)}% |
| 1089 |
\def\PstObjectsThreeDFaceC{\psdots(.2,.2)(.5,.5)(.8,.8)}% |
| 1090 |
\def\PstObjectsThreeDFaceD{% |
| 1091 |
\psdots(.2,.2)(.2,.5)(.2,.8)(.8,.2)(.8,.5)(.8,.8)}% |
| 1092 |
\def\PstObjectsThreeDFaceE{\psdots(.2,.2)(.2,.8)(.5,.5)(.8,.2)(.8,.8)}% |
| 1093 |
\def\PstObjectsThreeDFaceF{\psdots(.2,.2)(.2,.8)(.8,.2)(.8,.8)}% |
| 1094 |
% \end{macrocode} |
| 1095 |
% |
| 1096 |
% \begin{macrocode} |
| 1097 |
\fi |
| 1098 |
% \end{macrocode} |
| 1099 |
% |
| 1100 |
% Now that the faces are defined, we can draw the cube, with only the |
| 1101 |
% visible faces if corners are not to be drawn. |
| 1102 |
% |
| 1103 |
% \begin{macrocode} |
| 1104 |
\ifPstObjectsThreeD@Corners |
| 1105 |
\else |
| 1106 |
\PstObjectsThreeD@OnlyVisibleFacestrue |
| 1107 |
\fi |
| 1108 |
\PstCube(#2,#3,#4){1}{1}{1}}} |
| 1109 |
% \end{macrocode} |
| 1110 |
% \end{macro} |
| 1111 |
% |
| 1112 |
% \subsection{Internal functions to draw the faces} |
| 1113 |
% |
| 1114 |
% To draw successively the six faces in the right order. |
| 1115 |
% |
| 1116 |
% \begin{macro}{\PstCube@DrawFaces} |
| 1117 |
% \begin{macrocode} |
| 1118 |
\def\PstCube@DrawFaces#1#2#3#4#5#6#7#8{% |
| 1119 |
\ifPstObjectsThreeD@OnlyVisibleFaces |
| 1120 |
\else |
| 1121 |
\bgroup |
| 1122 |
\ifPstObjectsThreeD@Corners |
| 1123 |
\psset{linecolor=\PstObjectsThreeD@CornersColor, |
| 1124 |
fillcolor=\PstObjectsThreeD@CornersColor}% |
| 1125 |
\fi |
| 1126 |
\bgroup |
| 1127 |
\ifPstObjectsThreeD@Corners |
| 1128 |
\def\PstObjectsThreeD@CornersLengthTmpA{0}% |
| 1129 |
\fi |
| 1130 |
\expandafter\csname PstCube@DrawFace#1\endcsname#7#8 |
| 1131 |
\expandafter\csname PstCube@DrawFace#2\endcsname#7#8 |
| 1132 |
\egroup |
| 1133 |
\bgroup |
| 1134 |
\ifPstObjectsThreeD@Corners |
| 1135 |
\def\PstObjectsThreeD@CornersLengthTmpB{0}% |
| 1136 |
\fi |
| 1137 |
\expandafter\csname PstCube@DrawFace#3\endcsname#7#8 |
| 1138 |
\egroup |
| 1139 |
\egroup |
| 1140 |
\fi |
| 1141 |
\expandafter\csname PstCube@DrawFace#4\endcsname#7#8 |
| 1142 |
\expandafter\csname PstCube@DrawFace#5\endcsname#7#8 |
| 1143 |
\expandafter\csname PstCube@DrawFace#6\endcsname#7#8} |
| 1144 |
% \end{macrocode} |
| 1145 |
% \end{macro} |
| 1146 |
% |
| 1147 |
% To draw the face A. |
| 1148 |
% |
| 1149 |
% \begin{macro}{\PstCube@DrawFaceA} |
| 1150 |
% \begin{macrocode} |
| 1151 |
\def\PstCube@DrawFaceA(#1,#2,#3)(#4,#5,#6){% |
| 1152 |
\pst@dima=-#4\psxunit |
| 1153 |
\divide\pst@dima\tw@ |
| 1154 |
\pst@dimc=#6\psyunit |
| 1155 |
\divide\pst@dimc\tw@ |
| 1156 |
\ThreeDput[normal=0 -1 0](#1,#2,#3){% |
| 1157 |
\PstObjectsThreeD@Shape(-#4,#6) |
| 1158 |
\ifx\PstObjectsThreeDFaceA\@undefined |
| 1159 |
\else |
| 1160 |
\rput[bl](-#4,0){\PstObjectsThreeDFaceA} |
| 1161 |
\fi |
| 1162 |
\ifx\PstObjectsThreeDFaceCenterA\@undefined |
| 1163 |
\else |
| 1164 |
\rput[c](\pst@dima,\pst@dimc){\PstObjectsThreeDFaceCenterA} |
| 1165 |
\fi}} |
| 1166 |
% \end{macrocode} |
| 1167 |
% \end{macro} |
| 1168 |
% |
| 1169 |
% To draw the face B. |
| 1170 |
% |
| 1171 |
% \begin{macro}{\PstCube@DrawFaceB} |
| 1172 |
% \begin{macrocode} |
| 1173 |
\def\PstCube@DrawFaceB(#1,#2,#3)(#4,#5,#6){% |
| 1174 |
\pst@dimb=#5\psxunit |
| 1175 |
\divide\pst@dimb\tw@ |
| 1176 |
\pst@dimc=#6\psyunit |
| 1177 |
\divide\pst@dimc\tw@ |
| 1178 |
\ThreeDput[normal=1 0 0](#1,#2,#3){% |
| 1179 |
\PstObjectsThreeD@Shape(#5,#6) |
| 1180 |
\ifx\PstObjectsThreeDFaceB\@undefined |
| 1181 |
\else |
| 1182 |
\rput[bl](0,0){\PstObjectsThreeDFaceB} |
| 1183 |
\fi |
| 1184 |
\ifx\PstObjectsThreeDFaceCenterB\@undefined |
| 1185 |
\else |
| 1186 |
\rput[c](\pst@dimb,\pst@dimc){\PstObjectsThreeDFaceCenterB} |
| 1187 |
\fi}} |
| 1188 |
% \end{macrocode} |
| 1189 |
% \end{macro} |
| 1190 |
% |
| 1191 |
% To draw the face C. |
| 1192 |
% |
| 1193 |
% \begin{macro}{\PstCube@DrawFaceC} |
| 1194 |
% \begin{macrocode} |
| 1195 |
\def\PstCube@DrawFaceC(#1,#2,#3)(#4,#5,#6){% |
| 1196 |
\pst@dimg=-#4\psxunit |
| 1197 |
\advance \pst@dimg by #1\psxunit |
| 1198 |
\pst@dima=#4\psxunit |
| 1199 |
\divide\pst@dima\tw@ |
| 1200 |
\pst@dimb=#5\psxunit |
| 1201 |
\divide\pst@dimb\tw@ |
| 1202 |
\ThreeDput[normal=0 0 1](\pst@dimg,#2,#3){{% |
| 1203 |
\psyunit=\psxunit |
| 1204 |
\PstObjectsThreeD@Shape(#4,#5) |
| 1205 |
\ifx\PstObjectsThreeDFaceC\@undefined |
| 1206 |
\else |
| 1207 |
\rput[bl](0,0){\PstObjectsThreeDFaceC} |
| 1208 |
\fi |
| 1209 |
\ifx\PstObjectsThreeDFaceCenterC\@undefined |
| 1210 |
\else |
| 1211 |
\rput[c](\pst@dima,\pst@dimb){\PstObjectsThreeDFaceCenterC} |
| 1212 |
\fi}}} |
| 1213 |
% \end{macrocode} |
| 1214 |
% \end{macro} |
| 1215 |
% |
| 1216 |
% To draw the face D. |
| 1217 |
% |
| 1218 |
% \begin{macro}{\PstCube@DrawFaceD} |
| 1219 |
% \begin{macrocode} |
| 1220 |
\def\PstCube@DrawFaceD(#1,#2,#3)(#4,#5,#6){% |
| 1221 |
\pst@dimg=#5\psxunit |
| 1222 |
\advance \pst@dimg by #2\psyunit |
| 1223 |
\pst@dima=-#4\psxunit |
| 1224 |
\divide\pst@dima\tw@ |
| 1225 |
\pst@dimc=#6\psyunit |
| 1226 |
\divide\pst@dimc\tw@ |
| 1227 |
\ThreeDput[normal=0 -1 0](#1,\pst@dimg,#3){% |
| 1228 |
\PstObjectsThreeD@Shape(-#4,#6) |
| 1229 |
\ifx\PstObjectsThreeDFaceD\@undefined |
| 1230 |
\else |
| 1231 |
\rput[bl](-#4,0){\PstObjectsThreeDFaceD} |
| 1232 |
\fi |
| 1233 |
\ifx\PstObjectsThreeDFaceCenterD\@undefined |
| 1234 |
\else |
| 1235 |
\rput[c](\pst@dima,\pst@dimc){\PstObjectsThreeDFaceCenterD} |
| 1236 |
\fi}} |
| 1237 |
% \end{macrocode} |
| 1238 |
% \end{macro} |
| 1239 |
% |
| 1240 |
% To draw the face E. |
| 1241 |
% |
| 1242 |
% \begin{macro}{\PstCube@DrawFaceE} |
| 1243 |
% \begin{macrocode} |
| 1244 |
\def\PstCube@DrawFaceE(#1,#2,#3)(#4,#5,#6){% |
| 1245 |
\pst@dimg=-#4\psxunit |
| 1246 |
\advance \pst@dimg by #1\psxunit |
| 1247 |
\pst@dimb=#5\psxunit |
| 1248 |
\divide\pst@dimb\tw@ |
| 1249 |
\pst@dimc=#6\psyunit |
| 1250 |
\divide\pst@dimc\tw@ |
| 1251 |
\ThreeDput[normal=1 0 0](\pst@dimg,#2,#3){% |
| 1252 |
\PstObjectsThreeD@Shape(#5,#6) |
| 1253 |
\ifx\PstObjectsThreeDFaceE\@undefined |
| 1254 |
\else |
| 1255 |
\rput[bl](0,0){\PstObjectsThreeDFaceE} |
| 1256 |
\fi |
| 1257 |
\ifx\PstObjectsThreeDFaceCenterE\@undefined |
| 1258 |
\else |
| 1259 |
\rput[c](\pst@dimb,\pst@dimc){\PstObjectsThreeDFaceCenterE} |
| 1260 |
\fi}} |
| 1261 |
% \end{macrocode} |
| 1262 |
% \end{macro} |
| 1263 |
% |
| 1264 |
% To draw the face F. |
| 1265 |
% |
| 1266 |
% \begin{macro}{\PstCube@DrawFaceF} |
| 1267 |
% \begin{macrocode} |
| 1268 |
\def\PstCube@DrawFaceF(#1,#2,#3)(#4,#5,#6){% |
| 1269 |
\pst@dimg=-#4\psxunit |
| 1270 |
\advance \pst@dimg by #1\psxunit |
| 1271 |
\pst@dimh=#6\psyunit |
| 1272 |
\advance \pst@dimh by #3\psyunit |
| 1273 |
\pst@dima=#4\psxunit |
| 1274 |
\divide\pst@dima\tw@ |
| 1275 |
\pst@dimb=#5\psxunit |
| 1276 |
\divide\pst@dimb\tw@ |
| 1277 |
\ThreeDput[normal=0 0 1](\pst@dimg,#2,\pst@dimh){{% |
| 1278 |
\psyunit=\psxunit |
| 1279 |
\PstObjectsThreeD@Shape(#4,#5) |
| 1280 |
\ifx\PstObjectsThreeDFaceF\@undefined |
| 1281 |
\else |
| 1282 |
\rput[bl](0,0){\PstObjectsThreeDFaceF} |
| 1283 |
\fi |
| 1284 |
\ifx\PstObjectsThreeDFaceCenterF\@undefined |
| 1285 |
\else |
| 1286 |
\rput[c](\pst@dima,\pst@dimb){\PstObjectsThreeDFaceCenterF} |
| 1287 |
\fi}}} |
| 1288 |
% \end{macrocode} |
| 1289 |
% \end{macro} |
| 1290 |
% |
| 1291 |
% \subsection{Internal functions} |
| 1292 |
% |
| 1293 |
% The \cs{psget@@viewpoint} macro is derived from the \cs{psset@@viewpoint} |
| 1294 |
% one (the values will not be the good ones, but in fact we are only |
| 1295 |
% interested by the signs of them...) |
| 1296 |
% |
| 1297 |
% \begin{macro}{\psget@@viewpoint} |
| 1298 |
% \begin{macrocode} |
| 1299 |
\def\psget@@viewpoint#1 #2 #3 #4\@nil{% |
| 1300 |
\pssetxlength{\pst@dima}{#1}% |
| 1301 |
\pssetylength{\pst@dimb}{#2}% |
| 1302 |
\pssetzlength{\pst@dimc}{#3}} |
| 1303 |
% \end{macrocode} |
| 1304 |
% \end{macro} |
| 1305 |
% |
| 1306 |
% Macro to draw an octogon. This is useful to put it on each face, to let |
| 1307 |
% corners appear on a cube in another color. This is specially suited for dies. |
| 1308 |
% |
| 1309 |
% \begin{macro}{\PstObjectsThreeD@Octogon} |
| 1310 |
% \begin{macrocode} |
| 1311 |
\def\PstObjectsThreeD@Octogon(#1,#2){% |
| 1312 |
\pst@dimh=\PstObjectsThreeD@CornersLength pt |
| 1313 |
\multiply\pst@dimh#1 |
| 1314 |
\pst@dimtonum{\pst@dimh}{\pst@tempa}% |
| 1315 |
\pst@dimh=\PstObjectsThreeD@CornersLengthTmpB pt |
| 1316 |
\multiply\pst@dimh#1 |
| 1317 |
\pst@dimtonum{\pst@dimh}{\pst@tempg}% |
| 1318 |
\pst@dimh=\@ne pt |
| 1319 |
\advance\pst@dimh-\PstObjectsThreeD@CornersLength pt |
| 1320 |
\multiply\pst@dimh#1 |
| 1321 |
\pst@dimtonum{\pst@dimh}{\pst@tempb}% |
| 1322 |
\pst@dimh=\@ne pt |
| 1323 |
\advance\pst@dimh-\PstObjectsThreeD@CornersLengthTmpA pt |
| 1324 |
\multiply\pst@dimh#1 |
| 1325 |
\pst@dimtonum{\pst@dimh}{\pst@tempe}% |
| 1326 |
\pst@dimh=\PstObjectsThreeD@CornersLength pt |
| 1327 |
\multiply\pst@dimh#2 |
| 1328 |
\pst@dimtonum{\pst@dimh}{\pst@tempc}% |
| 1329 |
\pst@dimh=\PstObjectsThreeD@CornersLengthTmpA pt |
| 1330 |
\multiply\pst@dimh#2 |
| 1331 |
\pst@dimtonum{\pst@dimh}{\pst@tempf}% |
| 1332 |
\pst@dimh=\@ne pt |
| 1333 |
\advance\pst@dimh-\PstObjectsThreeD@CornersLength pt |
| 1334 |
\multiply\pst@dimh#2 |
| 1335 |
\pst@dimtonum{\pst@dimh}{\pst@tempd}% |
| 1336 |
\pst@dimh=\@ne pt |
| 1337 |
\advance\pst@dimh-\PstObjectsThreeD@CornersLengthTmpB pt |
| 1338 |
\multiply\pst@dimh#2 |
| 1339 |
\pst@dimtonum{\pst@dimh}{\pst@temph}% |
| 1340 |
\pspolygon(\pst@tempa,0)(\pst@tempe,0)(#1,\pst@tempf)(#1,\pst@tempd) |
| 1341 |
(\pst@tempb,#2)(\pst@tempg,#2)(0,\pst@temph)(0,\pst@tempc)} |
| 1342 |
% \end{macrocode} |
| 1343 |
% \end{macro} |
| 1344 |
% |
| 1345 |
% Macro to increment the counter (\texttt{\#1}) and define (\texttt{\#2}) |
| 1346 |
% the corresponding letter between A (for~1) and F (for~6). |
| 1347 |
% |
| 1348 |
% \begin{macro}{\PstDie@Letter} |
| 1349 |
% \begin{macrocode} |
| 1350 |
\def\PstDie@Letter#1#2{% |
| 1351 |
\advance#1\@ne |
| 1352 |
\ifnum#1>6 |
| 1353 |
#1=\@ne |
| 1354 |
\fi |
| 1355 |
\def#2{\ifcase#1\or A\or B\or C\or D\or E\or F\fi}} |
| 1356 |
% \end{macrocode} |
| 1357 |
% \end{macro} |
| 1358 |
% |
| 1359 |
% \subsection{Closing} |
| 1360 |
% |
| 1361 |
% Catcodes restoration. |
| 1362 |
% |
| 1363 |
% \begin{macrocode} |
| 1364 |
\catcode`\@=\PstAtCode\relax |
| 1365 |
% \end{macrocode} |
| 1366 |
% |
| 1367 |
% \begin{macrocode} |
| 1368 |
%</pst-ob3d> |
| 1369 |
% \end{macrocode} |
| 1370 |
% |
| 1371 |
% \Finale |
| 1372 |
% \PrintIndex |
| 1373 |
% \PrintChanges |
| 1374 |
% |
| 1375 |
\endinput |
| 1376 |
%% |
| 1377 |
%% End of file `pst-ob3d.dtx' |