diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/pstricks/contrib/pst-3dplot |
Initial commit
Diffstat (limited to 'graphics/pstricks/contrib/pst-3dplot')
-rw-r--r-- | graphics/pstricks/contrib/pst-3dplot/Changes | 120 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-3dplot/README | 48 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.bib | 152 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.dat | 451 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.pdf | bin | 0 -> 3020360 bytes | |||
-rw-r--r-- | graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.tex | 2491 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-3dplot/dvips/pst-3dplot.pro | 932 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-3dplot/latex/pst-3dplot.sty | 17 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-3dplot/tex/pst-3dplot.tex | 2562 |
9 files changed, 6773 insertions, 0 deletions
diff --git a/graphics/pstricks/contrib/pst-3dplot/Changes b/graphics/pstricks/contrib/pst-3dplot/Changes new file mode 100644 index 0000000000..baa9872ce3 --- /dev/null +++ b/graphics/pstricks/contrib/pst-3dplot/Changes @@ -0,0 +1,120 @@ +pst-3dplot.pro -------- +0.33 2017-04-05 - added coorType=7 +0.32 2014-02-01 - modifications to coorType=6 +0.31 2014-01-29 - add coorType=6, like 5 with a z axis vice versa +0.30 2010-01-01 - add the subroutine /tx@ProjThreeD from pst-3d + to get rid of the dependency +0.29 2009-10-06 add option SphericalCoorType +0.28 2009-07-28 add option showgrid for sphere, paraboloid and cylinder +0.27 2008-11-12 add routine for scalar and vector product +0.26 2007-01-03 add routine for vector length +0.25 2007-12-22 add code for special rotating (Darrell Lamm) +0.24 2007-08-30 add code for special node calculating +0.23 2007-08-18 add coorType 0,1,2,3 code for convertTo2D + - add code IIIDCylinder and cylindrical coordinates + - add code for \psBox and \psCylinder +0.22 2006-01-11 add code for left-Handed coor (experimental) +0.21 2005-10-10 add code for 3D sphere +0.20 2005-01-14 add rotPoint subroutine with RotSequenz option +0.11 2005-01-11 add rotPoint subroutine + + +pst-3dplot.tex -------- +2.04 2017-04-05 - added coorType=7 +2.03 2014-12-01 - modifications to coorType=6 +2.02 2014-09-01 - use the alternative for hidden lines of \psThreeDBox +2.01 2014-08-25 - bugfix for \lineIIID@i which is defines by + pst-solides3d, too. +2.00 2014-03-26 - enable opacity setting for sphere and cylinder +1.99 2014-02-01 - make the optional arguments IIIDx|y|zTicksPlane + available for label _and_ ticks +1.98 2014-01-30 - added coorType=6 +1.97 2012-06-07 - fixed viewpoint for coorType>0 +1.96 2011-12-10 - added \pstThreeDPrism +1.95 2011-08-10 - fix bug with setting drawstyle for htlatex +1.94 2011-03-01 - fix bug with \pstThreeDSquare and filling/drawCoor +1.93 2010-09-27 - experimental \psplotImpIIID +1.92 2010-04-14 - enable the IIIDshowgrid optional argument +1.91 2010-02-19 - make the origin argument for \paParaboloid and + \psIIIDCylinder work +1.90 2010-02-18 - enable the comma option + - fix bug with tx@addDict for AlgParser +1.89 2010-01-28 - enable coordinates for calculations +1.88 2009-11-24 - new optional argument CoorOffset +1.87 2009-11-12 - fix problem with \def\pst@par{} for objects + - new boolean CheckCoor=true +1.86 2009-10-06 - add option SphericalCoorType for different Handling + of spherical coordinates +1.85 2009-08-14 - add option Hincrement for \psCylinder, preset to 0.5 +1.84 2009-07-28 - add option showgrid for sphere, paraboloid + and cylinder + - fix bug with \psBox +1.83 2008-11-18 - fix for a missing \if@IIIDlabels for x labels +1.82 2008-11-12 - rewrote \pstThreeDCircle to allow non perpendicular vectors + for the circle plane +1.81 2008-04-05 - rename the internal variablesIIID to prevent clash + with other packages + - change name off for planecorr to none +1.80 2008-02-08 - do not define the algebraic option, use the + one from pstricks-add +1.79 2008-01-03 - add option algebraic for 3d plots + - fix bug with ellipse phi=f(alpha)! +1.78 2007-10-11 - fix bug in \parametricPlotThreeD + - add option Debug=false|true for addtional + comments written into the log file + - add extended rotation stuff (Darrell Lamm) +1.77 2007-10-03 - fix trailing spaces in \pstThreeDNode +1.76 2007-08-30 - add optional argument nodeType for different setting + the node depending to a line and a plain +1.75 2007-08-18 - add optional argument coorType for different + types of coordinates + - add \psCylinder and \psBox with inside/outside view + - fix bug with the subticks option +1.74 2007-06-12 - fix bug with the optional argument of plane + - fix typo for pstParaboloid + - add macro pstIIIDCylinder + - add cylindrical coordinates + - revert Changes to the hidden line support +1.73 2007-02-12 better support for hidden lines of a box +1.72 2006-02-07 - allow negative direction for ellipse + - add code for left-Handed coor (experimental + and not documented) +1.71 2005-11-10 - latest xcolor needs ...={[cmyk]{.3,.4,.1,0}} + - fix a bug with Dx + - new macro for pstThreeDSphere which needs no pst-vue3d +1.70 2005-10-16 fixes a bug with \pst@tempa +1.69 2005-09-25 - add macro \pstParaboloid + - some modifications to the code +1.68 2005-08-02 fix a bug in \pstRotIIIDPoint +1.67 2005-07-23 add an option zCoor, to plot Lines like const=f(x,y) +1.66 2005-06-21 use the trig macros of trig.sty to prevent wrong values + for sin/cos(90) and 270 degrees +1.65 2005-02-24 set \def\pst@linetype{2} to prevent a undefined macro +1.64 2005-02-21 fix bug in pstThreeDPlaneGrid with the start + values, which should be in pt +1.63 2005-02-19 spurious blank +1.62 2005-02-16 some modifications to \pstThreeDEllipse +1.61 2005-02-08 spurious blanks in drawStyle +1.60 2005-02-03 whitespace and bug in parametric +1.59 2005-01-25 changes \variablesIIID +1.58 2005-01-18 more tests for the rotating option +1.57 2005-01-15 make showCoor run with the new rotate options +1.56 2005-01-14 option RotSequenz now available for all macros +1.55 2005-01-11 options RotX RotY RotZ now available for all macros +1.54 2005-01-03 pstRotPointIIID as a real TeX solution and fix a spurious blank + in ThreeDBox +1.53 2005-01-03 pstRotPointIIID returns the 3D coordinates of the rotated point. + pstRotPointIIID[RotX=..,RotY=..,RotZ=..](x,y,z)\xVal\yVal\zVal +1.52 2004-12-05 uncomment the moveto in psThreeDPlot, change all \edef to \def +1.51 2004-12-03 bugfix in parametricplotThreeD, use \pst@dima instead of \pst@cnta +1.50 2004-11-24 spurious blank in \pstThreeDBox +1.49 2004-11-18 mostly rewrite \parametricplot +1.48 2004-11-16 drawStyle was ignored +1.47 2004-11-16 change the subprocedure for specialplot +1.46 2004-11-16 change the subprocedure for quick plot +1.45 2004-11-15 some more tweaks to parametricplotThreeD +1.44 2004-11-15 bugfix in parametricplotThreeD +1.43 2004-11-07 bugfix in parametric plot +1.42 2004-11-04 added macro \psPlaneGrid +1.41 2004-10-31 modification to \psplane (Torsten Suhling) +1.40 2004-10-31 use pst-xkey diff --git a/graphics/pstricks/contrib/pst-3dplot/README b/graphics/pstricks/contrib/pst-3dplot/README new file mode 100644 index 0000000000..d6642cec84 --- /dev/null +++ b/graphics/pstricks/contrib/pst-3dplot/README @@ -0,0 +1,48 @@ +%% Package `pst-3dplot.tex' +%% +%% Herbert Voss <hvoss@tug.org> +%% +%% 2014-02-01 +%% + +PSTricks offers excellent macros to insert more or less complex +graphics into a document. pstricks.tex itself is the base for several +other additional packages, which are mostly named pst-xxxx, +like pst-3dplot. There exists several packages for plotting three +dimensional graphical objects. pst-3dplot is similiar to the +pst-plot package for two dimensional objects and mathematical functions. + + +Save the files + +pst-3dplot.sty +pst-3dplot.tex +pst-3dplot.pro + +in any place, where latex or any other TeX program will find it. +The pro file should go into $TEXMF$/dvips/pstricks/. + +pst-3dplot uses the extended version of the keyval package. So +be sure that you +- have installed xkeyval with the special pst-xkey + (CTAN: /macros/latex/contrib/xkeyval/) +- do not load another package after pst-3dplot, which loads + the old keyval.sty or pst-key.tex + + +If you like to get the documentation file in another format run + +latex pst-3dplot-doc.tex +bibtex pst-3dplot-doc +latex pst-3dplot-doc.tex +dvips pst-3dplot-doc.dvi + +to get a PostScript file. But pay attention, that the pst-3dplot +files are saved in the above mentioned way, before you run +latex on the documentation file. + +The intermediate DVI file works only with viewers which can +interprete the embedded PostScript code. + +For another PDF output read the introduction from +the documentation. diff --git a/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.bib b/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.bib new file mode 100644 index 0000000000..2fecc6ffd3 --- /dev/null +++ b/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.bib @@ -0,0 +1,152 @@ +%% -*-bibtex-*- +@STRING{tugboat = {TUGboat} } +@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} } + +@Book{companion, + author = {Michel Goosens and Frank Mittelbach and Sebastian Rahtz and Dennis Roegel and Herbert Vo\ss}, + title = {The {\LaTeX} {G}raphics {C}ompanion}, + publisher = {{Addison-Wesley Publishing Company}}, + edition = {second}, + year = {2007}, + address = {Boston, Mass.} +} + +@Article{girou:01:, + author = {Denis Girou}, + title = {Pr\'esentation de {PST}ricks}, + journal = {Cahier {GUT}enberg}, + year = 1994, + volume = {16}, + month = apr, + pages = {21-70} +} + +@Article{girou:02:, + author = {{Timothy Van} Zandt and Denis Girou}, + title = {Inside {PST}ricks}, + journal = TUGboat, + year = 1994, + volume = {15}, + month = sep, + pages = {239-246} +} + +@Book{PostScript, + Author = {Kollock, Nikolai G.}, + Title = {Post{S}cript richtig eingesetzt: vom {K}onzept zum + praktischen {E}insatz}, + Publisher = {IWT}, + Address = {Vaterstetten}, + year = 1989, +} + +@ctan{multido, + Title = {\texttt{multido.tex} - a loop macro, that supports fixed-point addition}, + Author = {Timothy Van Zandt}, + url = {/macros/generic/multido.tex}, + Note = {}, + year = 1997 +} + +@Book{PSTricks2, + author = {Herbert Vo\ss{}}, + title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, + edition = {7}, + publisher = {DANTE -- Lehmanns}, + year = {2016}, + location = {Heidelberg and Berlin} +} + +@Book{PSTricksE, + author = {Herbert Vo\ss{}}, + title = {\texttt{PSTricks} -- {G}raphics and {P}ost{S}cript for \LaTeX}, + edition = {1}, + publisher = {UIT}, + year = {2011}, + address = {Cambridge -- UK} +} + +@Book{LTXquick, + author = {Herbert Vo\ss{}}, + title = {{\LaTeX} quick reference}, + edition = {1}, + publisher = {UIT}, + year = {2012}, + address = {Cambridge -- UK} +} + +@Book{presentations, + author = {Herbert Vo\ss}, + title = {Presentations with \LaTeX}, + edition = {2}, + publisher = {DANTE -- Lehmanns Media}, + year = {2017}, + location = {Heidelberg and Berlin} +} + + +@Book{tbt, + author = {Victor Eijkhout}, + title = {\TeX\ by Topic -- {A} \TeX{}nician Reference}, + edition = {1}, + publisher = {DANTE -- lehmanns media}, + year = {2014}, + location = {Heidelberg and Berlin} +} + +@online{pdftricks, + Title = {PSTricks Support for pdf}, + Author = {Herbert Voss}, + url = {http://PSTricks.de/pdf/pdfoutput.phtml}, + year = 2002, +} + +@online{miwi, + Title = {References for \TeX{} and Friends}, + Author = {Michael Wiedmann and Peter Karp}, + url = {http://www.miwie.org/tex-refs/}, + year = 2003, +} + + +@Article{dtk02.2:jackson.voss:plot-funktionen, + author = {Laura E. Jackson and Herbert Vo{\ss}}, + title = {Die {P}lot-{F}unktionen von {\texttt{pst-plot}}}, + journal = dtk, + year = 2002, + volume = {2/02}, + altvolume = 2, + altnumber = 14, + month = jun, + pages = {27--34}, + annote = bretter, + abstract = { Im letzten Heft wurden die mathematischen Funktionen von + \PS~im Zusammenhang mit dem {\LaTeX}-Paket + \texttt{pst-plot} zum Zeichnen von Funktionen beschrieben + und durch Beispiele erl{\"a}utert. In diesem Teil werden + die bislang nur erw{\"a}hnten Plot-Funktionen f{\"u}r + externe Daten behandelt. } +} + +@Article{dtk02.1:voss:mathematischen, + author = {Herbert Vo{\ss}}, + title = {Die mathematischen {F}unktionen von {P}ostscript}, + journal = dtk, + year = 2002, + volume = {1/02}, + altvolume = 1, + altnumber = 14, + month = mar, + pages = {40-47}, + annote = bretter, + abstract = { \PS, faktisch genauso alt wie {\TeX}, ist im + Verh{\"a}ltnis dazu allgemein noch weniger bekannt, wenn es + darum geht zu beurteilen, was es denn nun im eigentlichen + Sinne ist. Au{\ss}erdem wird h{\"a}ufig vergessen, dass + sich mit den \PS-Funktionen viele Dinge erledigen lassen, + bei denen sonst auf externe Programme zur{\"u}ckgegriffen + wird. Dies wird im Folgenden f{\"u}r die mathematischen + Funktionen im Zusammenhang mit dem Paket \texttt{pst-plot} + gezeigt. } +} + diff --git a/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.dat b/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.dat new file mode 100644 index 0000000000..4e3d8c3ee8 --- /dev/null +++ b/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.dat @@ -0,0 +1,451 @@ +%% $Id: pst-3dplot-doc.dat 402 2017-04-05 06:58:06Z herbert $ +\begin{filecontents}{data3D.Roessler} +2.0, 0.0, 0.0 +1.9737089990827656, 0.31348417289942826, 0.024766924774833776 +1.8955421029937392, 0.6286215677998942, 0.040068360866723524 +1.7670706651447274, 0.9374105709682867, 0.04899535062052031 +1.590723362917843, 1.231909925153328, 0.053481257255618045 +1.3698988432765893, 1.5043858076910284, 0.05484157950815698 +1.1089929624834642, 1.7474740837870646, 0.05405054060802597 +0.8133700003182118, 1.9543472822476953, 0.051871025675487174 +0.48929474661269506, 2.1188790687368217, 0.048905975991643626 +0.14383482236825765, 2.2358007890268707, 0.04561506618192828 +-0.21526210928252393, 2.3008455575942284, 0.042324015908839975 +-0.5797140462526329, 2.3108757369567967, 0.03923987600327629 +-0.9408715928640635, 2.263989804617317, 0.03647450352611535 +-1.2899036444077485, 2.1596047939957033, 0.03407200270285084 +-1.6179979190813427, 1.9985108763333657, 0.032034456961492486 +-1.916571194474139, 1.7828952581841464, 0.030342125259363112 +-2.177483349570605, 1.5163333562604153, 0.028967036053499737 +-2.393249071003189, 1.203746100773438, 0.02788091910922922 +-2.5572411971516513, 0.8513231435128283, 0.027059201419929343 +-2.663879978198744, 0.4664126663883511, 0.02648269287557226 +-2.708802925631934, 0.05737937874793611, 0.02613812515779725 +-2.689010380642566, -0.366566854583293, 0.02601824308118291 +-2.6029824533543895, -0.7955685089005423, 0.02612181932183788 +-2.4507635874341873, -1.2193400325823622, 0.026453773503831633 +-2.2340116946856416, -1.627404968883053, 0.02702548109576835 +-1.9560095794567929, -2.009345350292753, 0.027855313387445277 +-1.6216372226896099, -2.3550576916809978, 0.0289694270702017 +-1.237304403725046, -2.6550095751380067, 0.030402801066270472 +-0.8108440834310077, -2.900490621836054, 0.032200483552030916 +-0.3513679296671862, -3.0838515925562944, 0.03441894582781 +0.13091369384807075, -3.1987254529413782, 0.037127316997633816 +0.6249040658632549, -3.2402244813488377, 0.04040805872135605 +1.1188607672806745, -3.205107879829453, 0.044356285531949 +1.6006599982584453, -3.0919148586449468, 0.04907639328314185 +2.0580794189191347, -2.901058780196999, 0.0546739031971644 +2.479094141310295, -2.6348786393672534, 0.06123953904374337 +2.8521805025686247, -2.2976448885720346, 0.06882184942853445 +3.1666224148830464, -1.8955173551046565, 0.07738493864933163 +3.4128151677144074, -1.4364537367227772, 0.08675049123655466 +3.5825610419485394, -0.9300679485338773, 0.09653017105594026 +3.669349217681727, -0.38743858293399275, 0.1060669508996468 +3.66860848741213, 0.1791307830717498, 0.1144200706612233 +3.577915325329169, 0.7563953873937568, 0.12043944425028498 +3.397134032103045, 1.330489785389733, 0.12296507773843657 +3.1284647683004594, 1.8872735777852254, 0.12113969095590112 +2.7763851169553395, 2.4126873166475082, 0.11474338069347088 +2.347493200120509, 2.893102419451378, 0.10439221252377785 +1.8502875359900435, 3.3156518363301752, 0.09145709971549322 +1.2949340704036636, 3.6685348067552614, 0.07768692767531428 +0.6930599799313174, 3.9412962989715026, 0.06469485290776422 +0.057580017439228595, 4.125085518611976, 0.0535544883671607 +-0.5974736410304217, 4.212896026809753, 0.0446737246961642 +-1.2571594448404535, 4.199784163977488, 0.03793342580559009 +-1.9058990041940127, 4.08305672575688, 0.032943967026847994 +-2.527814237674464, 3.8624164257608915, 0.02926777122899019 +-3.1071099498819583, 3.5400549870758162, 0.026539600559695866 +-3.628477534411971, 3.120686978802803, 0.024497408997019937 +-4.077499745532988, 2.6115208596257036, 0.022967312670967185 +-4.441042526876828, 2.022166249356186, 0.02183745323024855 +-4.70762377765629, 1.3644782840310743, 0.02103647475244307 +-4.867750520480961, 0.6523413832730903, 0.020519623345750852 +-4.914216423301318, -0.09860386913565528, 0.020260779880335346 +-4.842351978806912, -0.8712856726498582, 0.020248271372651484 +-4.6502202511419455, -1.6475713988268783, 0.020483040487167408 +-4.338752026039519, -2.4086757864272217, 0.020978468312466414 +-3.9118154036016124, -3.135598187701918, 0.02176162966335394 +-3.376216299081582, -3.8095791632607905, 0.02287609989009088 +-2.7416279233519663, -4.412565984627867, 0.02438674375662763 +-2.020449069764279, -4.927676106927448, 0.0263873000082302 +-1.2275929169104387, -5.339647448336166, 0.029012132811414647 +-0.3802100602126169, -5.635264385846258, 0.032454389441284426 +0.5026483767307007, -5.803748777659692, 0.03699417971765483 +1.4004193818863429, -5.837106085766177, 0.043042551339674814 +2.2914576917034366, -5.730417843942741, 0.05121029037211145 +3.153492702626417, -5.482073360400736, 0.0624150579030452 +3.9640955128490303, -5.093935743066385, 0.07804527614909976 +4.701135335990834, -4.571440165114393, 0.10020069599445576 +5.343202094338152, -3.9236257147151097, 0.1320161372093747 +5.869975027597972, -3.1631057496848705, 0.17801831977245255 +6.2625361048395805, -2.305983838099523, 0.244311599794074 +6.503681987676289, -1.3717191201774368, 0.3380681890205393 +6.57840462343104, -0.38292840523916694, 0.465331169945956 +6.474884726908676, 0.6349281065446967, 0.6259266868842355 +6.186450753049299, 1.654097487676016, 0.8054981916019673 +5.714653774106046, 2.645500975148737, 0.9687649074913285 +5.485153457789435, 3.015596510728925, 1.0166012832905595 +5.339921215942925, 3.226909997062504, 1.0384587046280915 +5.186682071136008, 3.434465541003078, 1.0551261961946548 +5.025763751435938, 3.6379611848927222, 1.0660892490337464 +4.85752084015581, 3.8371048422086753, 1.070925616446375 +4.68233081773646, 4.031615242907043, 1.0693258338419298 +4.500589406948257, 4.221222733824442, 1.0611105450485159 +4.3127053604557695, 4.4056699109614295, 1.04624341462459 +4.119094870078487, 4.584712065919897, 1.024838603272049 +3.920175808449217, 4.758117435522143, 0.9971620808818797 +2.9858392075994002, 5.452943762343482, 0.812612270361229 +1.9873096085271849, 6.017158252509305, 0.5761300699678681 +0.9483591098403636, 6.4385215920732435, 0.35692931483850815 +-0.11455517619792031, 6.707528542956261, 0.19734838656187356 +-1.1872791673771168, 6.816712688735985, 0.10256792576424685 +-2.253446438874668, 6.760732255312321, 0.055184392730956905 +-3.2928943998362246, 6.536949843632011, 0.03431243820247646 +-4.2825078678305575, 6.14607057676533, 0.025497726306147724 +-5.197910469921709, 5.592581854725916, 0.021436720358505936 +-6.014973211129965, 4.884947449140856, 0.01918889343414334 +-6.710904523262051, 4.0356034038898, 0.017735990844505094 +-7.265043812276318, 3.0608075975441884, 0.01673821309724795 +-7.6594970491088885, 1.980373355821153, 0.016067973381140088 +-7.879680210322718, 0.8173022776918248, 0.015667182591688332 +-7.914786129315629, -0.4026740342570332, 0.015507722703657849 +-7.758170400659039, -1.6516339387966874, 0.015580350992863473 +-7.407646979008621, -2.9000765303331484, 0.01589179881627153 +-6.865684276339126, -4.117590498576616, 0.016465388313506357 +-6.13949432143193, -5.2735666277557565, 0.017344502041150147 +-5.241009918259896, -6.337938044106181, 0.0185996519020146 +-4.1867474992434826, -7.281931234281177, 0.020341131584772302 +-2.9975565059563873, -8.078810200283934, 0.02274125667756507 +-1.6982597726010134, -8.704595969360401, 0.0260741453349296 +-0.3171939084766986, -9.138744160322855, 0.03078926449201528 +1.1143349960221263, -9.364764641047929, 0.03765316948011792 +2.562654596930381, -9.370769958811845, 0.04803576908048059 +3.992342511395334, -9.149944248777466, 0.06451815290928255 +5.3667650121129995, -8.700934303634424, 0.09225064072787606 +6.648340617555662, -8.028185919678632, 0.14213766833161504 +7.798060636152677, -7.142298355161241, 0.23861539188590877 +8.773105938261706, -6.06059156350814, 0.4390837635074791 +9.519689894888124, -4.808384473188431, 0.8817804579958542 +9.715556843103172, -4.329500150199969, 1.1494809094253977 +9.81773413178288, -4.016829077379845, 1.3658701874398937 +9.900541029238141, -3.6987075313296836, 1.6268138317999121 +9.962089675717698, -3.3758098556869536, 1.9410504302689513 +10.00018948311941, -3.04888662875504, 2.31855764021317 +10.012308012691376, -2.718776529596604, 2.770448931895757 +9.995538942646686, -2.3864195564228607, 3.3086837048966977 +9.946585194527254, -2.052871225277392, 3.94550210249929 +9.861768678171382, -1.7193170331617214, 4.692479619636648 +9.73708186383974, -1.387085996749398, 5.559093591932963 +9.568299782347848, -1.0576614731948493, 6.550718962065328 +9.351172749338911, -0.7326867662753687, 7.666044771925456 +9.08171801634688, -0.4139623126097994, 8.894047024693492 +8.756619968751496, -0.10343070822988398, 10.21087893622761 +8.373730800484582, 0.19685424764189477, 11.577326972515616 +7.932635745107376, 0.48477759808564364, 12.93775701555075 +7.435211636522119, 0.7582336234791117, 14.221599174082469 +6.886073311702125, 1.0152147309642172, 15.34821078463603 +6.292783529977407, 1.253912865084775, 16.235280564528697 +5.665714946560136, 1.4728231700121752, 16.809840791003843 +5.017506967463606, 1.670836476399769, 17.019770020196443 +4.362149705724899, 1.8473065769510475, 16.842950446240167 +3.713825877381265, 2.0020810431825202, 16.291491858477364 +3.0857122439713383, 2.1354902283238073, 15.409734893129361 +2.488955133350004, 2.2482965651157674, 14.266615196739622 +1.9319838250982082, 2.3416130942444733, 12.944584694656417 +1.420233020012231, 2.4168044221813445, 11.527975739133392 +0.956247998331239, 2.4753841494682987, 10.09331307070606 +0.5400756034519507, 2.518920634293532, 8.703000830901596 +0.16981526138056538, 2.5489590062894587, 7.402615450102852 +-0.15778744089136104, 2.5669630387768843, 6.221163204496736 +-0.446791500247129, 2.5742768833754552, 5.17327095280853 +-0.7016055965842285, 2.572104267210342, 4.262291727847539 +-0.9266456137826842, 2.5615015641386965, 3.483545485219481 +-1.126100478315251, 2.543380911374715, 2.827214855473147 +-1.3037900140486127, 2.5185199007406154, 2.280674836946092 +-1.4630940545519222, 2.487575018607852, 1.8302151859844284 +-1.6069325141944029, 2.45109672027427, 1.4622163609123322 +-1.7377790868385545, 2.409544675056006, 1.1638834278782881 +-1.9835141009235395, 2.3051188345791296, 0.7072590640032498 +-2.3887006417654564, 2.0322388292260882, 0.2504419005182213 +-2.7029450991651705, 1.694574861067702, 0.095879723140791 +-2.9461595995808962, 1.3024699225902538, 0.046384648911208894 +-3.120441752059532, 0.8651045444426645, 0.03102568413623744 +-3.2226426402441297, 0.39212482135232124, 0.02628376880301836 +-3.2490126324449267, -0.10594257459317138, 0.02482230257421722 +-3.1968404376558923, -0.617718546647487, 0.02445966059229445 +-3.065039502462036, -1.1311616703495304, 0.02457363465961232 +-2.8543708677787727, -1.6338232811282312, 0.024998893728533096 +-2.567525196349059, -2.113133158213107, 0.025704902922585416 +-2.2091308259491678, -2.5567008953635995, 0.026705749958042275 +-1.785706750424512, -2.952623596453139, 0.028036552844253267 +-1.305566047862898, -3.2897919355609506, 0.02974888148444629 +-0.778672311256114, -3.558186939832671, 0.03191197936863889 +-0.2164516650596476, -3.749159998455242, 0.034616199441869416 +0.3684362170460448, -3.85568883233519, 0.037977611037885356 +0.9623636917766951, -3.872602545102222, 0.04214318386540144 +1.5510320089789205, -3.7967694257303495, 0.04729557974764842 +2.1197934352965464, -3.627241869327315, 0.05365555176228012 +2.653992246923785, -3.365353587697903, 0.061478085033157916 +3.13931832811565, -3.0147651331161143, 0.07103549757493581 +3.562167899798263, -2.5814545673411113, 0.08257689459834969 +3.910007397782812, -2.073650761579123, 0.0962499172326951 +4.171738387102823, -1.5017072141949206, 0.11197133881160794 +4.338062453621372, -0.8779144330251918, 0.12924497912729804 +4.40184274907451, -0.21624914586490585, 0.14695809594983122 +4.358449680500153, 0.46794032378242034, 0.16324440859893477 +4.206059703699751, 1.1583098991424128, 0.17556317806347035 +3.945852221923799, 1.837947349374204, 0.1811491492776709 +3.582035878130457, 2.4898318659047374, 0.17785623663471162 +3.1216564558450273, 3.0972954319275137, 0.16513442617814475 +2.5742071345935607, 3.6444521233009963, 0.1446079484787909 +1.9511516041571946, 4.116570803965888, 0.11976405507229838 +1.265515665777983, 4.50038789165048, 0.09475388419321912 +0.5316507955859152, 4.784378524644285, 0.07293467873241884 +-0.23485145287864528, 4.9590119844316565, 0.05597412570263211 +-1.0172176600385359, 5.017005746945389, 0.0438864063753544 +-1.7976520000335394, 4.9535717414511655, 0.035710505226950406 +-2.5576493535039337, 4.7666332999592615, 0.030257246575309142 +-3.278432887475822, 4.456989159788667, 0.026552577356675305 +-3.9414535770933643, 4.028408073527033, 0.02395081115268852 +-4.528900136550702, 3.487646429671672, 0.022071478953300156 +-5.024191706107253, 2.844387271156328, 0.02070024783607598 +-5.412441335675305, 2.1111020142311916, 0.019715135865874634 +-5.6808833433057995, 1.3028375909386654, 0.01904461478416901 +-5.819257434483045, 0.4369328965050377, 0.01864674433575866 +-5.820141438919434, -0.4673302493523888, 0.01849933187934492 +-5.679224237377866, -1.3891349378201778, 0.01859553006488194 +-5.395511002335657, -2.3065876101821967, 0.018942383450095683 +-4.971454009298383, -3.1972174926703314, 0.01956141809463142 +-4.4130037914876645, -4.0385061693137025, 0.02049116364319508 +-3.729577201838434, -4.8084354074449545, 0.021792033072380295 +-2.9339409597276824, -5.486040590331391, 0.02355456279546037 +-2.0420114756136036, -6.051956660154793, 0.025912871771244884 +-1.0725741792652026, -6.488943374424333, 0.029066646146450676 +-0.04692829799898515, -6.782376979650935, 0.03331753837237578 +1.011533780954803, -6.92069617783731, 0.039130596376046725 +2.077799392177286, -6.895791618779578, 0.04724010498213066 +3.125741893881876, -6.703330299827618, 0.05883550970166927 +4.128632855587868, -6.343009575327733, 0.07589290221665458 +5.05961830871354, -5.818740669533577, 0.10176969660424362 +5.892093622654209, -5.138769866823729, 0.14226192916779143 +6.599875333110678, -4.315758780556568, 0.20741828746874774 +7.157025294453949, -3.3668651961391745, 0.3143937050896343 +7.53717722488323, -2.3138915913501545, 0.4910838146045407 +7.712402886847818, -1.183583822195186, 0.7781381478768689 +7.702595198900638, -0.42812350737966265, 1.0439443206254988 +7.67446561506387, -0.16104903030612147, 1.1543319115086785 +7.632948617868841, 0.10667973505044293, 1.2740675192698314 +7.577702707241738, 0.37459113695156165, 1.4030914042130438 +7.508409601786327, 0.6421985954099348, 1.5410859148352525 +7.424784720783314, 0.9090014912274651, 1.6874212963397872 +7.3265895117122435, 1.174486461988975, 1.8411028818789186 +7.213645486787356, 1.4381291707465322, 2.000724000730259 +7.08584965988093, 1.6993966058812497, 2.1644299556565616 +6.943190871410281, 1.9577499567045393, 2.3298992018535043 +6.785766265556659, 2.2126480877923727, 2.4943481856925693 +6.613796961846651, 2.463551605430367, 2.654565938477766 +6.427641769878991, 2.7099274723317506, 2.806983257762296 +6.227807666162028, 2.9512540835319805, 2.947779016098424 +6.014955722117556, 3.187026669889763, 3.0730228287014674 +5.789901274794582, 3.4167628500132214, 3.178849201542928 +5.55360738762086, 3.640008111750338, 3.261653809410884 +5.307171059256714, 3.8563409761556864, 3.3182983596224775 +5.051802181036778, 4.065377585263705, 3.3463073348055143 +4.788795867846453, 4.266775464006313, 3.3440384999603214 +4.519499421522313, 4.460236238021824, 3.3108099223278877 +4.245275745765818, 4.645507141955697, 3.2469695421247855 +3.9674654353598813, 4.82238122322642, 3.153898750303703 +3.6873499468628186, 4.9906962275751825, 3.0339482434427665 +3.406118191349739, 5.150332236745906, 2.890311600159902 +3.12483857935146, 5.301208206565302, 2.7268484372224377 +2.8444380385334895, 5.443277617587807, 2.547873693097576 +2.5656888886968816, 5.576523494457237, 2.357931944080772 +2.2892037827722778, 5.70095307113798, 2.1615755320945222 +2.0154382904471495, 5.81659237711927, 1.963162963248748 +1.744700180423593, 5.923480997223305, 1.7666901373964123 +1.4771640906470407, 6.021667219347792, 1.5756622622967296 +1.2128900784178058, 6.111203735988321, 1.3930095469083668 +0.9518445049863615, 6.192144012491572, 1.221045564426458 +0.6939218051735664, 6.2645393828484, 1.0614639164553341 +-0.13367115162002785, 6.442788205774359, 0.6342840983063279 +-1.2100627320994148, 6.539796844326074, 0.2835219482191382 +-2.2500752578957264, 6.47330114030099, 0.11884132977988426 +-3.250285613906829, 6.2439718165630005, 0.053540783798716775 +-4.196135046574074, 5.853976547089403, 0.030630197826803138 +-5.06721808478353, 5.30836764538657, 0.022794185472664354 +-5.841426690446052, 4.615743824149262, 0.01969558880997713 +-6.49731251295517, 3.7884251060162706, 0.018090568801295958 +-7.015335309385255, 2.8423586127367786, 0.01708190414542496 +-7.378614942584927, 1.796869599135022, 0.016424502946090293 +-7.573483778303709, 0.6743040965073674, 0.016040015635774094 +-7.589935824875993, -0.5004180261965485, 0.015898292204984368 +-7.421990842028393, -1.7003280993067817, 0.015990877115598788 +-7.067969634538142, -2.8970006812322575, 0.016325589098541916 +-6.53067286346075, -4.061200110703754, 0.01692684933937439 +-5.817456614184374, -5.163567557246352, 0.017839167606383377 +-4.940200121096248, -6.1753331992821865, 0.019134209420818293 +-3.9151636942566634, -7.06903715332754, 0.02092332395624553 +-2.762737912421797, -7.819242185681628, 0.023379365424123735 +-1.507088639344538, -8.403221137138818, 0.026775335282775335 +-0.17570671939801683, -8.801602493562855, 0.03155497686356822 +1.2011228608846187, -8.998958841781647, 0.038466861583705506 +2.5909080118789567, -8.984325476195657, 0.04883039563280974 +3.959550464832346, -8.751641095998316, 0.06508832904145288 +5.27187993096682, -8.300111543914891, 0.0920082395186199 +6.491952262475553, -7.63451620969267, 0.13940840432511697 +7.582728741990322, -6.7655182495985535, 0.22855155359934456 +8.504235695667463, -5.710136660241023, 0.4073621076943347 +9.20811152798848, -4.492766245374182, 0.7858121391867329 +9.451165302102465, -3.855239780635789, 1.1055274280121736 +9.538728049759913, -3.5487824808305026, 1.3015294428148347 +9.60797725252403, -3.2374138882555825, 1.5351398887405352 +9.657320484583641, -2.921770035363618, 1.8130777525095638 +9.684939493127859, -2.602551239693463, 2.1428510382632773 +9.688766889588388, -2.280530909880685, 2.5326290812217196 +9.666469882855933, -1.956565122748488, 2.990978057503707 +9.61544677823356, -1.6316026346257664, 3.52640607886616 +9.53284394188098, -1.3066947525309012, 4.146658713150576 +9.415602945542282, -0.9830041806268315, 4.857709656231626 +9.260549196207823, -0.6618115798446256, 5.6624125110823424 +9.064533744364885, -0.34451816086358333, 6.558827879034662 +8.8246380431223, -0.032642233174231594, 7.5383240751182985 +8.538445872813158, 0.27219263997712795, 8.583672245477596 +8.204376274793441, 0.5682802288555961, 9.66750511551185 +7.822055816070618, 0.8538668569942097, 10.751646442575037 +7.392689279428867, 1.127200064773404, 11.78788076034458 +6.919369017298653, 1.3865897566594572, 12.720638616816624 +6.407251476286789, 1.6304785279003384, 13.491757456852552 +5.863532687984796, 1.857515335339181, 14.046950117615348 +5.297178484840663, 2.066624596955634, 14.342995599670488 +4.718409083036545, 2.2570619159593073, 14.354193290377983 +4.137991836306676, 2.428448492773784, 14.076544122017214 +3.56644370491083, 2.580779005625226, 13.528566442022477 +3.013269128713752, 2.7144017827432787, 12.748512712193106 +2.486350177342758, 2.8299744395309956, 11.788705787494589 +1.991567428006029, 2.9284016773378174, 10.708389742557397 +1.5326763062431523, 3.0107638187008097, 9.566664406997642 +1.111412651787232, 3.0782446566456216, 8.41676250268043 +0.7277667707293325, 3.1320656685540738, 7.302342672856885 +0.38035226932532257, 3.1734312717389295, 6.25587062404158 +0.06680152098068329, 3.203487294892622, 5.298728978606063 +-0.21586367883078603, 3.2232927336407773, 4.442496444005661 +-0.47091757368808984, 3.233803404870099, 3.6908327091840016 +-0.7016852851618449, 3.2358653333210428, 3.0415177820901573 +-0.9113670530219425, 3.2302154707950024, 2.4883466894435937 +-1.1029238948033526, 3.2174874855420863, 2.0227212404575514 +-1.2790130538063487, 3.198220698721507, 1.6348862215863795 +-1.4419609777867257, 3.172870657692774, 1.3148241539969736 +-1.5937627029203614, 3.1418202395065937, 1.0528572151807694 +-2.101993274633046, 2.973898766660752, 0.43473201862887473 +-2.5847810587134488, 2.6976998774296685, 0.15751879947904163 +-2.9922994335070254, 2.3429048597644946, 0.06496206401319657 +-3.330759433172893, 1.9181764558962058, 0.0358259346748069 +-3.5958830026527364, 1.4324511357554033, 0.026842444524512437 +-3.7808117289834917, 0.8958832654085912, 0.02395993409664841 +-3.879094038380487, 0.32001719539312873, 0.022948452153386145 +-3.8857944085147933, -0.28233369457373164, 0.02260953028177438 +-3.797942906949124, -0.8973256865416054, 0.02262095594544851 +-3.614749318231863, -1.5103803447064017, 0.022904985845180904 +-3.3377133939902524, -2.1065141771427762, 0.023454955802998674 +-2.9706673764613685, -2.6706905197148485, 0.024290828231074365 +-2.519759241666018, -3.1881845090928103, 0.025449651451115808 +-1.9933783513761, -3.6449523887178614, 0.026985842011006955 +-1.402024457740835, -4.027996285751815, 0.028975119439600665 +-0.7581219020613374, -4.325715526817441, 0.031520951831475415 +-0.07578218002167188, -4.528235670683263, 0.0347637614190443 +0.6294805305888491, -4.627706768970493, 0.03889358380592709 +1.3410748905816168, -4.618562932289972, 0.0441669566516942 +2.0416917106858463, -4.497736074326341, 0.05092843998819987 +2.7136887905904636, -4.2648177080108765, 0.05963581740319053 +3.339492536353866, -3.9221638231602576, 0.07088462246215012 +3.902008102813728, -3.474939074113672, 0.08542038050110319 +4.385032053143094, -2.931097539961895, 0.10411353479736482 +4.77366655659884, -2.301297829232222, 0.12785123367156662 +5.054742731741975, -1.598749759384982, 0.15727688939648132 +5.217271726082073, -0.8389877036183063, 0.19230364240806544 +5.252949055601218, -0.03956194347898131, 0.23138920020006068 +5.156725206570757, 0.7803643398873721, 0.27075062838751673 +4.927401732470295, 1.6005236962698655, 0.3040238056894974 +4.5681094114996545, 2.400156334627911, 0.32313209997470504 +4.08642003346071, 3.1586915428744136, 0.32085409664722125 +3.4938552045651723, 3.85642307638721, 0.2944172416116539 +2.8047930883993217, 4.475078864418605, 0.24797520140879956 +2.035158163394719, 4.998212233635217, 0.19170451470456978 +1.2014911005469464, 5.411421482549435, 0.13745835146538982 +0.3207643012834232, 5.7024868102082795, 0.093765781759793 +-0.5892213537916692, 5.8615335075263335, 0.0634523891313674 +-1.5093806674510137, 5.881274687164368, 0.04472715433085047 +-2.4192604593651406, 5.757307783540075, 0.033934121077673546 +-3.297407191621176, 5.488397018788945, 0.0277537372422779 +-4.122007543817511, 5.07668250066827, 0.024018844302520725 +-4.871596642526892, 4.527787604766935, 0.021575384626606506 +-5.525725119205101, 3.850820720933396, 0.01987564499473809 +-6.0655606117591745, 3.058277173200811, 0.018665224236140972 +-6.474430162203531, 2.1658481028149694, 0.0178183893367252 +-6.738308740549882, 1.192142177853216, 0.017267501186505628 +-6.846251134397938, 0.1583259896609392, 0.01697544581004047 +-6.790759476974828, -0.9123099418886927, 0.016924936730755655 +-6.568077210921361, -1.9948510467672929, 0.017114494585318413 +-6.178400766600547, -3.063314263222376, 0.017557710692583973 +-5.626001640417001, -4.091247480383695, 0.018284903709690423 +-4.919253449813759, -5.0523596894206015, 0.019347338524572804 +-4.070560759420412, -5.9211675688611285, 0.020824959267892528 +-3.09618897094418, -6.673643467584464, 0.022839625640272938 +-2.0159973671696005, -7.287849378925841, 0.025577628900753647 +-0.8530806067698964, -7.744541587763247, 0.029328647324738187 +0.36667213111382246, -8.02773131734615, 0.034555018767795334 +1.6150858833262367, -8.125188076474256, 0.04201901687999983 +2.8622538906492307, -8.02887485190668, 0.053025034152899976 +4.0770997333103365, -7.735308526410829, 0.06989680817971138 +5.227882045487002, -7.245846501106422, 0.09694840842876788 +6.282516848871196, -6.566914925448461, 0.14250972076899507 +7.208466697162102, -5.710222731436574, 0.22319936228590626 +7.971688582343952, -4.6930644163752655, 0.3728132314695582 +8.533670662305425, -3.5389310473445112, 0.6596810992783806 +8.792131331877295, -2.6120979670690505, 1.0353870384931827 +8.839573646579051, -2.320764699318184, 1.1908713629857248 +8.87090257978366, -2.0259984600256704, 1.3704663272013125 +8.885109914401811, -1.7283585053857884, 1.5772735606251977 +8.881097244698829, -1.4284450082791116, 1.814485823966621 +8.857676470066595, -1.12690251875592, 2.085253163094494 +8.813576067259218, -0.8244233360033532, 2.3924916148919917 +8.747455325706813, -0.5217505509037185, 2.738624452728525 +8.657929020806591, -0.21968043442758103, 3.125249309712768 +8.543605113618995, 0.08093624479195093, 3.5527312692259185 +8.403137864997262, 0.37919448183198623, 4.019733159804797 +8.235298072199091, 0.6741374611037374, 4.522710410494463 +8.039060806729712, 0.9647617744429308, 5.055418494113888 +7.8137089270703575, 1.2500260430441696, 5.608504079115894 +7.558947747932823, 1.5288634497039384, 6.169272034614508 +7.275022760901465, 1.800198469238202, 6.721732355518512 +6.962828693048845, 2.0629677383684886, 7.247025158543007 +6.623995237931523, 2.316144539460267, 7.724290020767319 +6.260933494331983, 2.558765824549344, 8.1319843419636 +5.876828489402942, 2.789960152414162, 8.44956895026618 +5.475567766354555, 3.0089744573011714, 8.659383848476475 +5.061603759178425, 3.2151973290505755, 8.748458455059811 +4.639757459946976, 3.4081765562191655, 8.709967175545291 +4.214980731856892, 3.5876291076031235, 8.544072459209525 +3.792102169321868, 3.7534424667056783, 8.257994651697016 +3.3755846577409225, 3.905667172348013, 7.865289303919939 +2.969320826577103, 4.044501387296867, 7.384459978932202 +2.576485937968906, 4.1702691375708065, 6.837147440922006 +2.1994581655187235, 4.283394400083416, 6.24618676906171 +1.8398060496747326, 4.384373401081114, 5.633806716423572 +1.4983343389660104, 4.473747339258949, 5.02017580632379 +1.1751738331607897, 4.55207734628084, 4.422404448833488 +0.8698986325393181, 4.619922956552616, 3.8540194272411386 +0.5816549175960387, 4.677824789407899, 3.324855934686289 +0.30928809812589264, 4.726291637548075, 2.8412710676237256 +0.051458835632222436, 4.765791757613755, 2.4065696778141796 +-0.19325781671728326, 4.796747890208006, 2.0215413772617996 +-0.42629267470022375, 4.819535390028161, 1.6850272666076986 +-0.6490221440199537, 4.834482799536002, 1.3944587876822787 +-0.8627258255433654, 4.841874223821472, 1.1463336076973218 +-1.2954600223281432, 4.8333523089052575, 0.7384824684946624 +-2.110903216184799, 4.7165768459672535, 0.2800581822396751 +\end{filecontents} + + +\endinput diff --git a/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.pdf b/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.pdf Binary files differnew file mode 100644 index 0000000000..5445581f93 --- /dev/null +++ b/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.pdf diff --git a/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.tex b/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.tex new file mode 100644 index 0000000000..f44958f181 --- /dev/null +++ b/graphics/pstricks/contrib/pst-3dplot/doc/pst-3dplot-doc.tex @@ -0,0 +1,2491 @@ +\input{pst-3dplot-doc.dat} + +%% $Id: pst-3dplot-doc.tex 401 2017-04-05 06:57:36Z herbert $ +\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings + headexclude,footexclude,oneside,dvipsnames,svgnames]{pst-doc} +\listfiles + +\usepackage[utf8]{inputenc} + +\usepackage{biblatex} +\addbibresource{\jobname.bib} + +\usepackage{pst-grad,pst-3dplot} +\let\pstFV\fileversion +\let\belowcaptionskip\abovecaptionskip + +%\usepackage{pst-grad} +%\usepackage{showexpl} +%\usepackage{tabularx} +%\usepackage{longtable} +% + +\makeatletter +\renewcommand*\l@subsection{\bprot@dottedtocline{2}{1.5em}{3.6em}} +\renewcommand*\l@subsubsection{\bprot@dottedtocline{3}{3.8em}{4.5em}} +\makeatother +\def\bgImage{% +\begin{pspicture}(0,-3)(7,5) +\pstThreeDCoor[xMax=2,yMax=13,zMin=0,zMax=6,IIIDticks]% +\multido{\rA=2.0+2.5, + \rB=0.15+0.20}{5}{% + \pstParaboloid[% + SegmentColor={[cmyk]% + {\rB,0.1,0.11,0.1}}]% + (0,\rA,0){5}{1}}% height 5 and radius 1 +\pstThreeDLine[linestyle=dashed]{->}(0,0,5)(0,13,5) +\end{pspicture} +} +\lstset{explpreset={pos=l,width=-99pt,overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe={}}, + escapechar=?} +\def\textat{\char064}% +\let\verbI\texttt + +\begin{document} +\author{Herbert Voß} +\date{\today} +\title{3D plots: pst-3dplot} +\subtitle{A PSTricks package for drawing 3d objects, v\pstFV} +\maketitle + +\tableofcontents + + + +\clearpage +\begin{abstract} +The well known \LPack{pstricks} package offers excellent macros to insert more or less complex +graphics into a document. \LPack{pstricks} itself is the base for several other additional packages, +which are mostly named \nxLPack{pst-xxxx}, like \LPack{pst-3dplot}. +% +There exist several packages for plotting three dimensional graphical objects. \LPack{pst-3dplot} +is similiar to the \LPack{pst-plot} package for two dimensional objects and mathematical functions. + +This version uses the extended keyval package \LPack{xkeyval}, so be sure that you have installed +this package together with the spcecial one \LPack{pst-xkey} for PSTricks. The \LPack{xkeyval} +package is available at \href{http://www.dante.de/CTAN/macros/latex/contrib/xkeyval/}{CTAN:/macros/latex/contrib/xkeyval/}. +It is also important that after \LPack{pst-3dplot} no package is loaded, which uses the old keyval interface. + +\vfill\noindent +Thanks for feedback and contributions to:\\ +Bruce Burlton, Bernhard Elsner, Andreas Fehlner, +Christophe Jorssen, Markus Krebs, Chris Kuklewicz, Darrell Lamm, +Patrice Mégret, +Rolf Niepraschk, +Michael Sharpe, Uwe Siart, Thorsten Suhling, Maja Zaloznik + +\end{abstract} +\clearpage + +\section{The Parallel projection} + +%\psset{coorType=1} +Figure~\ref{Abb0-1} shows a point $P(x,y,z)$ in a three dimensional coordinate system ($x,y,z$) +with a transformation into $P^*(x^*,y^*)$, the Point in the two dimensional system ($x_E,y_E$). + +\begin{figure}[htb] +\centering +\unitlength1cm +\begin{picture}(10,9) +\thicklines +\put(0,8){\makebox(0,0)[l]{$\alpha$: horizontal rotating angle}} +\put(0,7.5){\makebox(0,0)[l]{$\beta$: vertikal rotating angle}} +% +\put(5.25,9){\makebox(0,0){z}} +\put(5,0){\vector(0,1){9}} +\put(6,5.5){\vector(-2,-1){5.5}} +\put(9.5,3){\makebox(0,0){y}} +\put(4,5.5){\vector(+2,-1){5.5}} +\put(0.5,3){\makebox(0,0){x}} +\thinlines +\put(0,5){\vector(+1,0){10}} +\put(5,5.02){\line(+1,0){1}} +\put(10,4.5){\makebox(0,0){$x_E$}} +\put(5.25,8.5){\makebox(0,0){$y_E$}} +\put(5.3,4.5){\makebox(0,0){$\alpha$}} +\put(2.6,3.6){\makebox(0,0){$\alpha$}} +% +\put(2,3.5){\line(+2,-1){5}} +\put(9,3){\line(-2,-1){3.5}} +\put(6,1.5){\line(0,1){5}} +\put(6,6.5){\circle*{0.2}} +\put(6.2,6.7){\makebox(0,0)[l]{$P(x,y,z)$}} +\put(6.2,6.3){\makebox(0,0)[l]{$P^*(x^*,y^*)$}} +\put(6.2,5.3){\makebox(0,0)[l]{$x^*$}} +% +\put(5,3){\line(+1,0){4}} +\put(7,2.7){\makebox(0,0){$y\cdot\sin\alpha$}} +\put(2,3.5){\line(+1,0){3}} +\put(3.5,3.2){\makebox(0,0){$x\cdot\cos\alpha$}} +\thicklines +\put(5,1.5){\line(+1,0){1}} +\put(5,1.52){\line(+1,0){1}} +\thinlines +\put(4.2,4.8){\makebox(0,0){$\alpha$}} +\thicklines +\put(5.03,5){\line(0,-1){2}} +\put(5.1,4){\makebox(0,0)[l]{$y\cdot\cos\alpha$}} +\put(4.97,5){\line(0,-1){1.5}} +\put(4.9,4.2){\makebox(0,0)[r]{$x\cdot\sin\alpha$}} +\thinlines +\put(5.5,0.5){\vector(0,+1){1}} +\put(5.5,0.5){\line(1,0){0.5}} +\put(6.2,0.5){\makebox(0,0)[l]{$y\cdot\sin\alpha-x\cdot\cos\alpha$}} +%\put(4.5,3.25){\vector(1,0){0.5}} +%\put(4.5,3.25){\line(-1,-2){1}} +%\put(3.5,1.25){\line(-1,0){0.5}} +\put(4.9,1.5){\makebox(0,0)[r]{$y\cdot\cos\alpha+x\cdot\sin\alpha$}} +\end{picture}% +\caption{Lengths in a three dimensional System}\label{Abb0-1} +\end{figure} + + +The angle $\alpha$ is the horizontal rotation with positive values for anti clockwise rotations +of the 3D coordinates. The angle $\beta$ is the vertical rotation (orthogonal to the paper plane). +In figure~\ref{Abb0-2} we have $\alpha=\beta=0$. The y-axis comes perpendicular out of the paper +plane. Figure~\ref{Abb0-3} shows the same for another angle with a view from the side, where the +x-axis shows into the paper plane and the angle $\beta$ is greater than $0$ degrees. + +\begin{figure}[htb] +\centering +\unitlength1cm +\begin{picture}(2,2.5) +\thicklines +\put(2.2,2){\makebox(0,0){$z$}} +\put(2,0.5){\vector(0,1){2}} +\put(2,0.5){\vector(-1,0){2}} +\put(0.5,0.7){\makebox(0,0){$x$}} +\put(2,0.5){\circle*{0.2}} +\put(2,0.5){\circle{0.5}} +\put(2.3,0.7){\makebox(0,0)[l]{$y$}} +\end{picture} +\caption{Coordinate System for $\alpha=\beta=0$ ($y$-axis comes out of the paper plane)}\label{Abb0-2} +\end{figure} + + +The two dimensional x coordinate $x^*$ is the difference of the two horizontal lengths +$y\cdot\sin\alpha$ und $x\cdot\cos\alpha$ (figure \ref{Abb0-1}): +\begin{equation} +x^{*}=-x\cdot\cos\alpha+y\cdot\sin\alpha +\end{equation} + + + +The z-coordinate is unimportant, because the rotation comes out of the paper plane, so we have +only a different $y^*$ value for the two dimensional coordinate but no other $x^*$ value. +The $\beta$ angle is well seen in figure \ref{Abb0-3} which derives from figure \ref{Abb0-2}, +if the coordinate system is rotated by $90$\textdegree\ horizontally to the left and vertically by $\beta$ +also to the left. + +\begin{figure}[htbp] +\unitlength1cm +\centering +\begin{picture}(1,3) +\thicklines +\put(1.5,2.9){\makebox(0,0){z}} +\put(2,1){\vector(-1,2){1}} +\put(2,1){\vector(-2,-1){2}} +\put(0,0.3){\makebox(0,0){y}} +\put(2,1){\circle{0.5}} +\put(1.8,0.8){\line(1,1){0.4}} +\put(1.8,1.2){\line(1,-1){0.4}} +\put(2.3,1.2){\makebox(0,0)[l]{x}} +\thinlines +\put(2,1){\line(-1,0){2}} +\put(2,1){\line(0,1){2}} +\put(1.7,2){\makebox(0,0){$\beta$}} +\put(1.3,0.8){\makebox(0,0){$\beta$}} +\put(2,2.5){\line(-1,0){0.75}} +\put(2.2,2.5){\makebox(0,0)[l]{$z*_1=z\cdot\cos\beta$}} +\put(1,1){\line(0,-1){0.5}} +\put(1.3,0.5){\makebox(0,0)[l]{$y\cdot\cos\alpha+x\cdot\sin\alpha$}} +\put(0.9,0.7){\makebox(0,0)[r]{$-(y\cdot\cos\alpha+x\cdot\sin\alpha)\cdot\sin\beta$}} +\end{picture} +\caption{Coordinate System for $\alpha=0$ and $\beta>0$ ($x$-axis goes into the paper plane)}\label{Abb0-3} +\end{figure} + + +The value of the perpendicular projected z coordinate is $z^{*}=z\cdot cos\beta$. With +figure~\ref{Abb0-3} we see, that the point $P(x,y,z)$ runs on an elliptical curve when +$\beta$ is constant and $\alpha$ changes continues. The vertical alteration of $P$ is +the difference of the two "`perpendicular"' lines $y\cdot\cos\alpha$ and $x\cdot\sin\alpha$. +These lines are rotated by the angle $\beta$, so we have them to multiply with $\sin\beta$ to +get the vertical part. We get the following transformation equations: + +\begin{equation} +\begin{array}{lll} + x_{E} & = & -x\cos\alpha+y\sin\alpha\\ + y_{E} & = & -(x\sin\alpha+y\cos\alpha)\cdot\sin\beta+z\cos\beta +\end{array} +\end{equation} + +\noindent or written in matrix form: +{\footnotesize\addtolength{\arraycolsep}{-2pt} +\begin{equation} +\begin{pmatrix}x_E\\y_E\end{pmatrix}= + \begin{pmatrix} + -\cos\alpha & \sin\alpha & 0\\ + -\sin\alpha\sin\beta & -\cos\alpha\sin\beta & \cos\beta + \end{pmatrix}\cdot +\begin{pmatrix}x\\y\\z\end{pmatrix} +\end{equation}% +\addtolength{\arraycolsep}{2pt}% +} + +All following figures show a grid, which has only the sense to make things clearer. + +\section{Options} +All options which are set with \Lcs{psset} are global and all which are passed with the optional +argument of a macro are local for this macro. This is an important fact for setting the angles +\Lkeyword{Alpha} and \Lkeyword{Beta}. Mostly all macro need these values, this is the reason why they +should be set with \Lcs{psset} and not part of an optional argument. + + +\section{Coordinates and Axes} +\LPack{pst-3dplot} accepts cartesian or spherical coordinates. In both cases there +must be three parameters: \verb+(x,y,z)+ or alternatively ($r$,$\phi$,$\theta$), +where $r$ is the radius, $\phi$ the \Index{longitude angle} and $\theta$ the \Index{lattitude angle}. +For the spherical coordinates set the option \Lkeyword{SphericalCoor}=\true. Spherical coordinates +are possible for all macros where three dimensional coordinates are expected, except +for the plotting functions (math functions and data records). Maybe that this is also interesting +for someone, then let me know. + +Unlike coordinates in two dimensions, three dimensional coordinates +may be specified using PostScript code, which need not be preceded by +\Lnotation{!}. For example, assuming \verb+\def\nA{2}+, (1,0,2) and +\verb+(90 cos, 100 100 sub, \nA\space 2 div 1 add)+ specify the same point. +(Recall that a \Lcs{space} is required after a macro that will be +expanded into PostScript code, as \TeX\ absorbs the space following a +macro.) + + +The syntax for drawing the coordinate axes is + +\begin{BDef} +\Lcs{pstThreeDCoor}\OptArgs +\end{BDef} + +The only special option is \Lkeyword{drawing}\texttt{=true|false}, which enables the drawing of the +coordinate axes. The default is true. In nearly all cases the \Lcs{pstThreeDCoor} macro +must be part of any drawing to initialize the 3d-system. If \Lkeyword{drawing} is set to +\verb+false+, then all ticklines options are also disabled. + +Without any options we get the default view with the in table~\ref{tab:coor} +listed options with the predefined values. + +{ +\begin{longtable}{@{}l>{\ttfamily}lll@{}} +\caption{All new parameters for \texttt{pst-3dplot}\label{tab:coor}}\\ +\textrm{name} & \textrm{type} & \textrm{Default} & \emph{page}\\\hline +\endfirsthead +\textrm{name} & \textrm{type} & \textrm{Default} & \emph{page}\\\hline +\endhead +\Lkeyword{Alpha} & <angle> & 45 & \pageref{exa:Alpha}\\ +\Lkeyword{Beta} & <angle> & 30 & \pageref{exa:Beta}\\ +\Lkeyword{xMin} & <value> & -1 & \pageref{exa:xMin}\\ %ok +\Lkeyword{xMax} & <value> & 4 & \pageref{exa:xMax}\\ %ok +\Lkeyword{yMin} & <value> & -1 & \pageref{exa:yMin}\\ %ok +\Lkeyword{yMax} & <value> & 4 & \pageref{exa:yMax}\\ %ok +\Lkeyword{zMin} & <value> & -1 & \pageref{exa:zMin}\\ %ok +\Lkeyword{zMax} & <value> & 4 & \pageref{exa:zMax}\\ %ok +\Lkeyword{nameX} & <string> & \$x\$ & \pageref{exa:nameX}\\ +\Lkeyword{spotX} & <angle> & 180 & \pageref{exa:spotX}\\ +\Lkeyword{nameY} & <string> & \$y\$ & \pageref{exa:nameY}\\ +\Lkeyword{spotY} & <angle> & 0 & \pageref{exa:spotY}\\ +\Lkeyword{nameZ} & <string> & \$z\$ & \pageref{exa:nameZ}\\ +\Lkeyword{spotZ} & <angle> & 90 & \pageref{exa:spotZ}\\ +\Lkeyword{IIIDticks} & false|true & false & \pageref{exa:IIIDticks}\\ +\Lkeyword{IIIDlabels} & false|true & false& \pageref{exa:IIIDlabels}\\ +\Lkeyword{Dx} & <value> & 1 & \pageref{exa:Dx}\\ +\Lkeyword{Dy} & <value> & 1 & \pageref{exa:Dy}\\ +\Lkeyword{Dz} & <value> & 1 & \pageref{exa:Dz}\\ +\Lkeyword{IIIDxTicksPlane} & xy|xz|yz & xy & \pageref{exa:IIIDxTicksPlane}\\ +\Lkeyword{IIIDyTicksPlane} & xy|xz|yz & yz & \pageref{exa:IIIDyTicksPlane}\\ +\Lkeyword{IIIDzTicksPlane} & xy|xz|yz & yz & \pageref{exa:IIIDzTicksPlane}\\ +\Lkeyword{IIIDticksize} & <value> & 0.1 & \pageref{exa:IIIDticksize}\\ +\Lkeyword{IIIDxticksep} & <value> & -0.4 & \pageref{exa:IIIDxticksep}\\ +\Lkeyword{IIIDyticksep} & <value> & -0.2 & \pageref{exa:IIIDyticksep}\\ +\Lkeyword{IIIDzticksep} & <value> & 0.2 & \pageref{exa:IIIDzticksep}\\ +\Lkeyword{RotX} & <angle> & 0 & \pageref{exa:RotX}\\ +\Lkeyword{RotY} & <angle> & 0 & \pageref{exa:RotY}\\ +\Lkeyword{RotZ} & <angle> & 0 & \pageref{exa:RotZ}\\ +\Lkeyword{RotAngle} & <angle> & 0 & \pageref{exa:RotAngle}\\ +\Lkeyword{xRotVec} & <angle> & 0 & \pageref{exa:xRotVec}\\ +\Lkeyword{yRotVec} & <angle> & 0 & \pageref{exa:yRotVec}\\ +\Lkeyword{zRotVec} & <angle> & 0 & \pageref{exa:zRotVec}\\ +\Lkeyword{RotSequence} & xyz|xzy|yxz|yzx|zxy|zyx|quaternion & xyz & \pageref{exa:RotSequence}\\ +\Lkeyword{RotSet} & set|concat|keep & set & \pageref{exa:RotSet}\\ +\Lkeyword{eulerRotation} & true|false & false & \pageref{eulerRotation}\\ +\Lkeyword{IIIDOffset} & \{<x,y,z>\} & \{0,0,0\} & \pageref{exa:IIIDOffset}\\ +\Lkeyword{zlabelFactor} & <text> & \verb=\relax= & \pageref{exa:zlabelFactor}\\ +\Lkeyword{comma} & false|true & false & \pageref{exa:comma}\\ +\end{longtable} +} + + +\xLcs{pstThreeDCoor} +\lstset{wide=false} +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-3,-2.5)(3,4.25) + \pstThreeDCoor +\end{pspicture} +\end{LTXexample} + +There are no restrictions for the angles and the max and min values for the axes; all \verb|pstricks| +options are possible as well. The following example changes the color and the width of the axes. + +\medskip +\noindent\fbox{\parbox{\columnwidth-2\fboxsep}{The angles \verbI{Alpha} and \verbI{Beta} are +important to all macros and should always be set with \verbI{psset} to make them global to all +other macros. Otherwise they are only local inside the macro to which they are passed.}} + +\medskip +\Lkeyword{Alpha} ist the horizontal and \Lkeyword{Beta} the vertical rotation angle of the +Cartesian coordinate system. + + + +\label{exa:xMax}\label{exa:yMax}\label{exa:zMax}\label{exa:Alpha}\label{exa:Beta} +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-1.25)(1,2.25) + \pstThreeDCoor[linewidth=1.5pt,linecolor=blue, + xMax=2,yMax=2,zMax=2, + Alpha=-60,Beta=30] +\end{pspicture} +\end{LTXexample} + + + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2)(2,2) + \pstThreeDCoor[xMax=2,yMax=2,zMax=2] +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2)(2,2) + \pstThreeDCoor[xMax=2,yMax=2,zMax=2, + Alpha=30,Beta=60] +\end{pspicture} +\end{LTXexample} + + + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2)(2,2) + \pstThreeDCoor[xMax=2,yMax=2,zMax=2, + Alpha=30,Beta=-60] +\end{pspicture} +\end{LTXexample} + + + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2)(2,2) + \pstThreeDCoor[ + xMax=2,yMax=2,zMax=2, + Alpha=90,Beta=60] +\end{pspicture} +\end{LTXexample} + + + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2)(2,2) + \pstThreeDCoor[linewidth=1.5pt, + xMax=2,yMax=2,zMax=2, + Alpha=40,Beta=0] +\end{pspicture} +\end{LTXexample} + + +\lstset{wide=true} + +\subsection{Ticks, comma and labels} +With the option \Lkeyword{IIIDticks} the axes get ticks and with \Lkeyword{IIIDlabels} labels. +Without ticks also labels are not possible. The optional argument \Lkeyword{comma}, which is +defined in the package \LPack{pst-plot} allows to use a comma instead of a dot for real values. +There are several +options to place the labels in right plane to get an optimal view. The view of the +ticklabels can be changed by redefining the macro + +\begin{verbatim} +\def\psxyzlabel#1{\bgroup\footnotesize\textsf{#1}\egroup} +\end{verbatim} + +\label{exa:IIIDticksize} +\xLcs{pstThreeDPut} +\psset{unit=1.25,gridlabels=0pt} +\begin{LTXexample}[width=7.25cm] +\begin{pspicture}(-3,-2.5)(3,4) + \pstThreeDCoor[IIIDticks,IIIDticksize=0.05]% + \pstThreeDPut(3,0,3){\Huge default} +\end{pspicture} +\end{LTXexample} + +\label{exa:IIIDticks}\label{exa:IIIDlabels}\label{exa:xMin}\label{exa:yMin}\label{exa:zMin} +\begin{LTXexample}[width=7.25cm] +\begin{pspicture}(-3,-2.5)(3,4) + \pstThreeDCoor[linecolor=black, + IIIDticks,IIIDlabels, + xMin=-2,yMin=-2,zMin=-2] +\end{pspicture} +\end{LTXexample} + +\label{exa:comma}\label{exa:IIIDzTicksPlane}\label{exa:IIIDyTicksPlane}\label{exa:IIIDxTicksPlane} +\label{exa:IIIDxticksep}\label{exa:IIIDyticksep}\label{exa:IIIDzticksep} +\label{exa:Dx}\label{exa:Dy}\label{exa:Dz} +\begin{LTXexample}[width=7.25cm] +\begin{pspicture}(-3,-2.5)(3,4) + \pstThreeDCoor[linecolor=black, + IIIDticks,IIIDzTicksPlane=yz, + IIIDzticksep=-0.2,IIIDlabels, + IIIDxTicksPlane=yz,,IIIDxticksep=-0.2, + IIIDyTicksPlane=xy,,IIIDyticksep=0.2, + comma,Dx=1.25,Dy=1.5,Dz=0.25] +\end{pspicture} +\end{LTXexample} + +The following example shows a wrong placing of the labels, the planes should be changed. + +\begin{LTXexample}[width=7.25cm] +\psset{Alpha=-60,Beta=60} +\begin{pspicture}(-4,-2.25)(1,3) + \pstThreeDCoor[linecolor=black,% + IIIDticks,Dx=2,Dy=1,Dz=0.25]% +\end{pspicture} +\end{LTXexample} + +\label{exa:planecorr} +\begin{LTXexample}[width=7.25cm] +\psset{Alpha=-60,Beta=60} +\begin{pspicture}(-4,-2.25)(1,3) + \pstThreeDCoor[linecolor=black,% + IIIDticks,IIIDlabels, + planecorr=normal, + Dx=2,Dy=1,Dz=0.25]% +\end{pspicture} +\end{LTXexample} + +\xLkeyval{xyrot} +\begin{LTXexample}[width=7.25cm] +\psset{Alpha=-60,Beta=60} +\begin{pspicture}(-4,-2.25)(1,3) + \pstThreeDCoor[linecolor=black,% + IIIDticks,IIIDlabels, + planecorr=xyrot, + Dx=2,Dy=1,Dz=0.25]% +\end{pspicture} +\end{LTXexample} + +For the z axis it is possible to define a factor for the values, e.g. + +\setIIIDplotDefaults\label{exa:zlabelFactor}\xLkeyword{zlabelFactor} +\xLkeyword{zlabelFactor} +%\define@key[psset]{pst-3dplot}{zlabelFactor}[\relax]{\def\psk@zlabelFactor{#1}} +\begin{LTXexample}[width=7.25cm] +\begin{pspicture}(-4,-2.25)(1,4) + \pstThreeDCoor[IIIDticks,IIIDlabels, + zlabelFactor=$\cdot10^3$] +\end{pspicture} +\end{LTXexample} + + +\subsection{Offset} +The optional argument \Lkeyword{IIIDOffset} allows to set the intermediate point of all +axes to another point as the default of \verb+(0,0,0)+. The values have to be put into braces: +%\define@key[psset]{pst-3dplot}{zlabelFactor}[\relax]{\def\psk@zlabelFactor{#1}} + +\label{exa:IIIDOffset}\xLkeyword{IIIDOffset} +\begin{LTXexample}[width=7.25cm] +\begin{pspicture}(-4,-1.25)(1,4) + \pstThreeDCoor[IIIDticks,IIIDlabels, + yMin=-3,IIIDOffset={(1,-2,1)}] +\end{pspicture} +\end{LTXexample} + +\subsection{Experimental features} +All features are as long as they are not really tested called experimental. With the optional +argument \Lkeyword{coorType}, which is by default 0, one can change the the viewing of the axes +and all other three dimensional objects. + +With \Lkeyword{coorType}=1 the y--z-axes are orthogonal and the angle between x- and y-axis +is \Lkeyword{Alpha}. The angle \Lkeyword{Beta} is not valid. + +\label{exa:coorType}\xLkeyword{coorType} +\begin{LTXexample}[width=9.75cm] +\psset{coorType=1,Alpha=135} +\begin{pspicture}(-2,-3)(3,3.5) +\pstThreeDCoor[IIIDticks,zMax=3]% +\end{pspicture} +\end{LTXexample} + + + + + +With \Lkeyword{coorType}=2 the y--z-axes are orthogonal and the angle between x- and y-axis +is always 135 degrees and the x-axis is shortened by a factor of $1/\sqrt{2}$. +The angle \Lkeyword{Alpha} is only valid for placing the ticks, if any. The angle \Lkeyword{Beta} is not valid. + +\xLkeyval{yz} +\begin{LTXexample}[width=9.75cm] +\psset{coorType=2,Alpha=90, + IIIDxTicksPlane=yz} +\begin{pspicture}(-2,-2)(3,3.5) +\pstThreeDCoor[IIIDticks,zMax=3]% +\end{pspicture} +\end{LTXexample} + +With \Lkeyword{coorType}=3 the y--z-axes are orthogonal and the angle between x- and y-axis +is always 45 degrees and the x-axis is shortened by a factor of $1/\sqrt{2}$. +The angle \Lkeyword{Alpha} is only valid for placing the ticks, if any. The angle \Lkeyword{Beta} is not valid. + +\begin{LTXexample}[width=9.75cm] +\psset{coorType=3,Alpha=90, + IIIDxTicksPlane=yz} +\begin{pspicture}(-2,-2)(3,3.5) +\pstThreeDCoor[IIIDticks,zMax=3]% +\end{pspicture} +\end{LTXexample} + +\Lkeyword{coorType}=4 is also called the trimetrie-view. One angle of the axis is 5 and the other 15 degrees. +The angles \Lkeyword{Alpha} and \Lkeyword{Beta} are not valid. + +\begin{LTXexample}[width=9.75cm] +\psset{coorType=4,IIIDxTicksPlane=yz} +\begin{pspicture}(-2,-2)(3,3.5) +\pstThreeDCoor[IIIDticks,zMax=3]% +\end{pspicture} +\end{LTXexample} + +With \Lkeyword{coorType}=5 the $y$-$z$-axes are orthogonal and the angle between x- and y-axis +is variable but should be 30 or 45 degrees and the x-axis is shortened by a factor of $0.5$. +The angle \Lkeyword{Beta} is not valid. + +\xLkeyval{yz}\xLkeyword{coorType} +\begin{LTXexample}[width=9.75cm] +\psset{coorType=5,Alpha=30, + IIIDxTicksPlane=yz} +\begin{pspicture}(-2,-2)(3,4) +\pstThreeDCoor[IIIDticks,zMax=3]% +\end{pspicture} +\end{LTXexample} + + +For \Lkeyword{coorType}=6 the $x$-axis us shortend by 0.559. + +%\setIIIDplotDefaults +\psset{unit=1cm} +\xLkeyword{coorType} +\begin{LTXexample}[width=9cm] +\psset{coorType=6} +\begin{pspicture}(-3,-2)(6,6) +\psset{IIIDxTicksPlane=xz,IIIDyTicksPlane=yz} +\pstThreeDCoor[xMin=0,xMax=5,yMin=0,yMax=5, + zMin=0,zMax=5,IIIDticks,spotX=180, + IIIDlabels=false,linecolor=red]% +\multido{\iA=1+1}{4}{\footnotesize% + \pstThreeDPut(\iA,-0.3,0.1){\iA}% + \pstThreeDPut(-0.3,\iA,0.1){\iA}% + \pstThreeDPut(0,-0.3,\iA){\iA}} +\end{pspicture} +\end{LTXexample} + +For \Lkeyword{coorType}=7 the $x$-axis us shortend by 0.5. + +%\setIIIDplotDefaults +\psset{unit=1cm} +\xLkeyword{coorType} +\begin{LTXexample}[width=9cm] +\psset{coorType=7} +\begin{pspicture}(-3,-2)(6,6) +\psset{IIIDxTicksPlane=xz,IIIDyTicksPlane=yz} +\pstThreeDCoor[xMin=0,xMax=5,yMin=0,yMax=5, + zMin=0,zMax=5,IIIDticks,spotX=180, + IIIDlabels=false,linecolor=red]% +\multido{\iA=1+1}{4}{\footnotesize% + \pstThreeDPut(\iA,-0.3,0.1){\iA}% + \pstThreeDPut(-0.3,\iA,0.1){\iA}% + \pstThreeDPut(0,-0.3,\iA){\iA}} +\end{pspicture} +\end{LTXexample} + +\clearpage +\section{Rotation} + +The coordinate system can be rotated independent from the given Alpha +and Beta values. This makes it possible to place +the axes in any direction and any order. There are the three options +\Lkeyword{RotX}, \Lkeyword{RotY}, \Lkeyword{RotZ} and an +additional one for the rotating sequence (\Lkeyword{rotSequence}), which can +be any combination of the three letters \verb+xyz+. + +\label{exa:RotZ} +\begin{LTXexample}[pos=t] +\begin{pspicture}(-6,-3)(6,3) + \multido{\iA=0+10}{18}{% + \pstThreeDCoor[RotZ=\iA,xMin=0,xMax=5,yMin=0,yMax=5,zMin=-1,zMax=3]% + } +\end{pspicture} +\end{LTXexample} + + +\label{exa:RotX}\label{exa:RotY}\label{exa:RotSequence} +\begin{LTXexample}[pos=t] +\psset{unit=2,linewidth=1.5pt,drawCoor=false} +\begin{pspicture}(-2,-1.5)(2,2.5)% + \pstThreeDCoor[xMin=0,xMax=2,yMin=0,yMax=2,zMin=0,zMax=2]% + \pstThreeDBox[RotX=90,RotY=90,RotZ=90,% + linecolor=red](0,0,0)(.5,0,0)(0,1,0)(0,0,1.5) + \pstThreeDBox[RotSequence=xzy,RotX=90,RotY=90,RotZ=90,% + linecolor=yellow](0,0,0)(.5,0,0)(0,1,0)(0,0,1.5) + \pstThreeDBox[RotSequence=zyx,RotX=90,RotY=90,RotZ=90,% + linecolor=green](0,0,0)(.5,0,0)(0,1,0)(0,0,1.5) + \pstThreeDBox[RotSequence=zxy,RotX=90,RotY=90,RotZ=90,% + linecolor=blue](0,0,0)(.5,0,0)(0,1,0)(0,0,1.5) + \pstThreeDBox[RotSequence=yxz,RotX=90,RotY=90,RotZ=90,% + linecolor=cyan](0,0,0)(.5,0,0)(0,1,0)(0,0,1.5) + \pstThreeDBox[RotSequence=yzx,RotX=90,RotY=90,RotZ=90,% + linecolor=magenta](0,0,0)(.5,0,0)(0,1,0)(0,0,1.5) + \pstThreeDBox[fillstyle=gradient,RotX=0](0,0,0)(.5,0,0)(0,1,0)(0,0,1.5) + \pstThreeDCoor[xMin=0,xMax=2,yMin=0,yMax=2,zMin=0,zMax=2]% +\end{pspicture}% +\end{LTXexample} + + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-2,-1.5)(2,2.5)% + \pstThreeDCoor[xMin=0,xMax=2,yMin=0,yMax=2,zMin=0,zMax=2]% + \pstThreeDBox(0,0,0)(.5,0,0)(0,1,0)(0,0,1.5) + \pstThreeDBox[RotX=90,linecolor=red](0,0,0)(.5,0,0)(0,1,0)(0,0,1.5) + \pstThreeDBox[RotX=90,RotY=90,linecolor=green](0,0,0)(.5,0,0)(0,1,0)(0,0,1.5) + \pstThreeDBox[RotX=90,RotY=90,RotZ=90,linecolor=blue](0,0,0)(.5,0,0)(0,1,0)(0,0,1.5) +\end{pspicture}% +\end{LTXexample} + + +It is sometimes more convenient to rotate the coordinate system by +specifying a \emph{single} angle of rotation \Lkeyword{RotAngle} (in degrees) +about a vector whose coordinates are \Lkeyword{xRotVec}, \Lkeyword{yRotVec}, +and \Lkeyword{zRotVec} using the \Lkeyval{quaternion} option for \Lkeyword{RotSequence}. + +\label{exa:RotAngle}\label{exa:xRotVec}\label{exa:yRotVec}\label{exa:zRotVec} +\begin{LTXexample}[pos=t] +\begin{pspicture}(-3,-1.8)(3,3) +\multido{\iA=0+10}{18}{% + \pstThreeDCoor[linecolor=red, RotSequence=quaternion, RotAngle=\iA, xRotVec=3,yRotVec=0,zRotVec=3, + xMin=0,xMax=3, yMin=0,yMax=3, zMin=0,zMax=3]} +\pstThreeDCoor[linecolor=blue, RotSequence=quaternion, RotAngle=0, xRotVec=0, yRotVec=0, zRotVec=1, + xMin=0,xMax=3, yMin=0,yMax=3, zMin=0,zMax=3] +\pstThreeDLine[linecolor=blue, linewidth=2pt, arrows=->](0,0,0)(3,0,3) +\uput[0](-2.28,1.2){$\vec{R}_\Phi$} +\end{pspicture} +\end{LTXexample} + +Rotations of the coordinate system may be ``accumulated'' by applying +successive rotation sequences using the \Lkeyword{RotSet} variable, +which is set either as a \LPack{pst-3dplot} object's optional argument, or +with a \verb+\psset[pst-3dplot]{RotSet=value}+ +command. The usual \TeX{} scoping rules for the value of \Lkeyval{RotSet} +hold. The following are valid values of \Lkeyword{RotSet}: +\begin{itemize} +\item \Lkeyval{set}: Sets the rotation matrix using the rotation +parameters. This is the default value for \Lkeyword{RotSet} and is +what is used if \verb+RotSet+ is not set as an option for the +\verb+pst-3dplot+ object, or if not previously +set within the object's scope by a \verb+\psset[pst-3dplot]{RotSet=val}+ +command. +\item \Lkeyval{concat}: Concatenates the current rotation matrix with +a the new rotation that is defined by the rotation parameters. This option +is most useful when multiple \Lcs{pstThreeDCoor} calls are made, +with or without actual plotting of the axes, +to accumulate rotations. A previous value of \Lkeyset{RotSet=set} +must have been made! +\item \Lkeyval{keep}: Keeps the current rotation matrix, ignoring the +rotation parameters. Mostly used internally to eliminate redundant +calculations. +\end{itemize} + +\label{exa:RotSet} +\begin{LTXexample}[pos=t] +\begin{pspicture}(-3,-3)(3.6,3) +\pstThreeDCoor[linecolor=blue, RotSequence=quaternion, RotAngle=0, RotSet=set, xRotVec=0,yRotVec=0,zRotVec=1, + xMin=0,xMax=3, yMin=0,yMax=3, zMin=0,zMax=3] + \pstThreeDCoor[linecolor=green, RotSequence=quaternion, RotSet=concat, RotAngle=22.5, xRotVec=0,yRotVec=0,zRotVec=1, + xMin=0,xMax=3, yMin=0,yMax=3, zMin=-0.6,zMax=3] + \pstThreeDCoor[linecolor=yellow, RotSequence=quaternion, RotSet=concat, RotAngle=30, xRotVec=0,yRotVec=1,zRotVec=0, + xMin=0,xMax=3,yMin=-0.6,yMax=3, zMin=0,zMax=3] + \pstThreeDCoor[linecolor=red, RotSequence=quaternion, RotSet=concat, RotAngle=60, xRotVec=1,yRotVec=0,zRotVec=0, + xMin=-0.6,xMax=3, yMin=0,yMax=3, zMin=0,zMax=3]% +\end{pspicture} +\end{LTXexample} + +\label{eulerRotation} +By default, the rotations defined by \verb+RotX+, \verb+RotY+, and +\verb+RotZ+ are rotations about the \emph{original} coordinate system's, +$x$, $y$, or $z$ +axes, respectively. More traditionally, however, these rotation angles +are defined as rotations about the rotated coordinate system's \emph{current}, +$x$, $y$, or $z$ axis. The \verb+pst-3dplot+ variable option +\verb+eulerRotation+ can be set to \verb+true+ to activate Euler angle +definitions; i.e., \Lkeyword{eulerRotation}=\true. The default is +\verb+eulerRotation=false+. + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-4,-5)(6,5) + \pstThreeDCoor[linecolor=red, RotSequence=zyx, RotZ=90,RotY=90,RotX=0, + xMin=0,xMax=5, yMin=0,yMax=5, zMin=0,zMax=5] + \pstThreeDCoor[linecolor=blue, RotSequence=zyx, RotZ=0,RotY=0,RotX=0, + xMin=0,xMax=2.5, yMin=0,yMax=2.5, zMin=0,zMax=2.5] +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-3,-5)(7,5) + \pstThreeDCoor[eulerRotation=true, linecolor=red, RotSequence=zyx, RotZ=90, RotY=90, RotX=0, + xMin=0,xMax=5, yMin=0,yMax=5, zMin=0,zMax=5] + \pstThreeDCoor[linecolor=blue, RotSequence=zyx, RotZ=0,RotY=0,RotX=0, + xMin=0,xMax=2.5, yMin=0,yMax=2.5, zMin=0,zMax=2.5] +\end{pspicture} +\end{LTXexample} + +\clearpage +\psset{unit=1cm,gridlabels=7pt} + + +\section{Plane Grids} +\begin{BDef} +\Lcs{pstThreeDPlaneGrid}\OptArgs(xMin,yMin)(xMax,yMax) +\end{BDef} + +There are three additional options + +\noindent +\begin{tabularx}{\linewidth}{@{}>{\bfseries\ttfamily}lX@{}} +planeGrid & can be one of the following values: \Lkeyval{xy}, \Lkeyval{xz}, \Lkeyval{yz}. Default is \Lkeyval{xy}.\\ +subticks & Number of ticks. Default is \verb+10+.\footnotemark \\ +planeGridOffset & a length for the shift of the grid. Default is \verb+0+. +\end{tabularx} + +\footnotetext{This options is also defined +in the package \nxLPack{pstricks-add}, so it is nessecary to to set this option +locally or with the family option of \nxLPack{pst-xkey}, eg \Lcs{psset}\texttt{[pst-3dplot]\{subticks=...\}}}. +This macro is a special one for the coordinate system to show the units, but can +be used in any way. \Lkeyword{subticks} defines the number of ticklines for both axes and +\Lkeyword{xsubticks} and \Lkeyword{ysubticks} for each one. + +\iffalse +\newpsstyle{xyPlane}{fillstyle=solid,fillcolor=black!20} +\newpsstyle{xzPlane}{fillstyle=solid,fillcolor=black!35,planeGrid=xz} +\newpsstyle{yzPlane}{fillstyle=solid,fillcolor=black!50,planeGrid=yz} +\fi + +\noindent +\begin{minipage}{0.49\linewidth} +\begin{LTXexample}[pos=t,wide=false] +\begin{pspicture}(-4,-3.5)(5,4) + \pstThreeDCoor[xMin=0,yMin=0,zMin=0,linewidth=2pt] + \psset{linewidth=0.1pt,linecolor=lightgray} + \pstThreeDPlaneGrid(0,0)(4,4) + \pstThreeDPlaneGrid[planeGrid=xz](0,0)(4,4) + \pstThreeDPlaneGrid[planeGrid=yz](0,0)(4,4) +\end{pspicture} +\end{LTXexample} +\end{minipage}\hfill +\begin{minipage}{0.49\linewidth} +\begin{LTXexample}[pos=t,wide=false] +\begin{pspicture}(-3,-3.5)(5,4) + \psset{coorType=2}% set it globally! + \pstThreeDCoor[xMin=0,yMin=0,zMin=0,linewidth=2pt] + \psset{linewidth=0.1pt,linecolor=lightgray} + \pstThreeDPlaneGrid(0,0)(4,4) + \pstThreeDPlaneGrid[planeGrid=xz](0,0)(4,4) + \pstThreeDPlaneGrid[planeGrid=yz](0,0)(4,4) +\end{pspicture} +\end{LTXexample} +\end{minipage} + + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-1,-2)(10,10) + \psset{Beta=20,Alpha=160,subticks=7} + \pstThreeDCoor[xMin=0,yMin=0,zMin=0,xMax=7,yMax=7,zMax=7,linewidth=1pt] + \psset{linewidth=0.1pt,linecolor=gray} + \pstThreeDPlaneGrid(0,0)(7,7) + \pstThreeDPlaneGrid[planeGrid=xz,planeGridOffset=7](0,0)(7,7) + \pstThreeDPlaneGrid[planeGrid=yz](0,0)(7,7) + \pscustom[linewidth=0.1pt,fillstyle=gradient,gradbegin=gray,gradmidpoint=0.5,plotstyle=curve]{% + \psset{xPlotpoints=200,yPlotpoints=1} + \psplotThreeD(0,7)(0,0){ x dup mul y dup mul 2 mul add x 6 mul sub y 4 mul sub 3 add 10 div } + \psset{xPlotpoints=1,yPlotpoints=200,drawStyle=yLines} + \psplotThreeD(7,7)(0,7){ x dup mul y dup mul 2 mul add x 6 mul sub y 4 mul sub 3 add 10 div } + \psset{xPlotpoints=200,yPlotpoints=1,drawStyle=xLines} + \psplotThreeD(7,0)(7,7){ x dup mul y dup mul 2 mul add x 6 mul sub y 4 mul sub 3 add 10 div } + \psset{xPlotpoints=1,yPlotpoints=200,drawStyle=yLines} + \psplotThreeD(0,0)(7,0){ x dup mul y dup mul 2 mul add x 6 mul sub y 4 mul sub 3 add 10 div }} + \pstThreeDPlaneGrid[planeGrid=yz,planeGridOffset=7](0,0)(7,7) +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-6,-2)(4,7) + \psset{Beta=10,Alpha=30,subticks=7} + \pstThreeDCoor[xMin=0,yMin=0,zMin=0,xMax=7,yMax=7,zMax=7,linewidth=1.5pt] + \psset{linewidth=0.1pt,linecolor=gray} + \pstThreeDPlaneGrid(0,0)(7,7) + \pstThreeDPlaneGrid[planeGrid=xz](0,0)(7,7) + \pstThreeDPlaneGrid[planeGrid=yz](0,0)(7,7) + \pscustom[linewidth=0.1pt,fillstyle=gradient,gradbegin=gray,gradend=white,gradmidpoint=0.5, + plotstyle=curve]{% + \psset{xPlotpoints=200,yPlotpoints=1} + \psplotThreeD(0,7)(0,0){ x dup mul y dup mul 2 mul add x 6 mul sub y 4 mul sub 3 add 10 div } + \psset{xPlotpoints=1,yPlotpoints=200,drawStyle=yLines} + \psplotThreeD(7,7)(0,7){ x dup mul y dup mul 2 mul add x 6 mul sub y 4 mul sub 3 add 10 div } + \psset{xPlotpoints=200,yPlotpoints=1,drawStyle=xLines} + \psplotThreeD(7,0)(7,7){ x dup mul y dup mul 2 mul add x 6 mul sub y 4 mul sub 3 add 10 div } + \psset{xPlotpoints=1,yPlotpoints=200,drawStyle=yLines} + \psplotThreeD(0,0)(7,0){ x dup mul y dup mul 2 mul add x 6 mul sub y 4 mul sub 3 add 10 div }} + \pstThreeDPlaneGrid[planeGrid=xz,planeGridOffset=7](0,0)(7,7) + \pstThreeDPlaneGrid[planeGrid=yz,planeGridOffset=7](0,0)(7,7) +\end{pspicture} +\end{LTXexample} + +\medskip +The equation for the examples is +\[ f(x,y)=\frac{x^2+2y^2-6x-4y+3}{10} \] + +\section{Put} +There exists a special option for the put macros: \xLkeyword{pOrigin} +\begin{verbatim} +pOrigin=lt|lB|lb|t|c|B|b|rt|rB|rb +\end{verbatim} +for the placing of the text or other objects. + +\fboxsep0pt +\newcommand\Gobble[1]{} +\newsavebox{\FrBox} +\savebox{\FrBox}{\Huge\fbox{Rotating}} +\unitlength1pt +\begin{center} +\newcommand{\Hoehe}{\ht\FrBox\Gobble} +\newcommand{\Breite}{\wd\FrBox\Gobble} +\newcommand{\Tiefe}{\dp\FrBox\Gobble} +\newlength{\totalHeight} +\setlength{\totalHeight}{\ht\FrBox} +\addtolength{\totalHeight}{\dp\FrBox} +\newcommand{\tHoehe}{\totalHeight\Gobble} +\begin{picture}(1.7\Breite,\Hoehe) + \put(,\Hoehe){\textcolor{red}{\circle*{3}}} +% \put(0.5\Breite ,\Hoehe){\textcolor{red}{\circle*{3}}} + \put(\Breite,\Hoehe){\textcolor{red}{\circle*{3}}} + % center +% \put(0,0.5\Hoehe){\textcolor{red}{\circle*{3}}}% + \put(0.5\Breite,0.5\Hoehe){\textcolor{red}{\circle*{3}}}% +% \put(\Breite,0.5\Hoehe){\textcolor{red}{\circle*{3}}}% + % Baseline + \put(0,0){\textcolor{red}{\circle*{3}}}% +% \put(0.5\Breite,0){\textcolor{red}{\circle*{3}}}% + \put(\Breite,0){\textcolor{red}{\circle*{3}}}% + % bottom + \put(0,-\Tiefe){\textcolor{red}{\circle*{3}}}% +% \put(0.5\Breite,-\Tiefe){\textcolor{red}{\circle*{3}}}% + \put(\Breite,-\Tiefe){\textcolor{red}{\circle*{3}}}% + % labels + \put(0,1.2\Hoehe){l} + \put(0.5\Breite,1.2\Hoehe){c} + \put(\Breite,1.2\Hoehe){r} + \put(1.05\Breite,0.9\Hoehe){t} + \put(1.05\Breite,0.4\Hoehe){c} + \put(1.15\Breite,-1){\textbf{B}aseline} + \put(1.05\Breite,-1.2\Tiefe){b} + \put(0,0){\usebox{\FrBox}}% +\end{picture} +\end{center} + + +This works only well for the \Lcs{pstThreeDPut} macro. The default is \Lkeyval{c} and for the +\Lcs{pstPlanePut} the left baseline \Lkeyval{lB}. + +\subsection{\nxLcs{pstThreeDPut}} +The syntax is similiar to the \Lcs{rput} macro: + +\begin{BDef} +\Lcs{pstThreeDPut}\OptArgs\Largr{x,y,z}\Largb{any stuff} +\end{BDef} + +\begin{LTXexample}[width=3.25cm] +\begin{pspicture}(-2,-1.25)(1,2.25) + \psset{Alpha=-60,Beta=30} + \pstThreeDCoor[linecolor=blue,% + xMin=-1,xMax=2,yMin=-1,yMax=2,zMin=-1,zMax=2] + \pstThreeDPut(1,0.5,1.25){pst-3dplot} + \pstThreeDDot[drawCoor=true](1,0.5,1.25) +\end{pspicture} +\end{LTXexample} + + +\medskip +Internally the \Lcs{pstThreeDPut} macro defines the two dimensional node \verb|temp@pstNode| +and then uses the default \Lcs{rput} macro from \LPack{pstricks}. In fact of the perspective +view od the coordinate system, the 3D dot must not be seen as the center of the printed stuff. + +\subsection[\texttt{pstPlanePut}]{\texttt{pstPlanePut}\protect\footnote{Thanks to Torsten Suhling}} +The syntax of the \Lcs{pstPlanePut} is + +\begin{BDef} +\Lcs{pstPlanePut}\OptArgs\Largr{x,y,z}\Largb{Object} +\end{BDef} + +We have two special parameters, \Lkeyword{plane} and \Lkeyword{planecorr}; both are optional. Let's start with +the first parameter, \Lkeyword{plane}. +Possible values for the two dimensional plane are \Lkeyval{xy}, \Lkeyval{xz}, and \Lkeyval{yz}. If this parameter is missing +then \Lkeyset{plane=xy} is set. The first letter marks the positive direction for the width +and the second for the height. + +The object can be of any type, in most cases it will be some kind of text. The reference point +for the object is the left side and vertically centered, often abbreviated as \verb|lB|. The +following examples show for all three planes the same textbox. + +\begin{LTXexample}[width=7.25cm] +\begin{pspicture}(-4,-4)(3,4) + \psset{Alpha=30} + \pstThreeDCoor[xMin=-4,yMin=-4,zMin=-4] + \pstPlanePut[plane=xy](0,0,-3){\fbox{\Huge\red xy plane}} + \pstPlanePut[plane=xy](0,0,0){\fbox{\Huge\red xy plane}} + \pstPlanePut[plane=xy](0,0,3){\fbox{\Huge\red xy plane}} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=7.25cm] +\begin{pspicture}(-5,-3)(2,3) + \pstThreeDCoor[xMin=2,yMin=-4,zMin=-3,zMax=2] + \pstPlanePut[plane=xz](0,-3,0){\fbox{\Huge\green\textbf{xz plane}}} + \pstPlanePut[plane=xz](0,0,0){\fbox{\Huge\green\textbf{xz plane}}} + \pstPlanePut[plane=xz](0,3,0){\fbox{\Huge\green\textbf{xz plane}}} +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[width=7.25cm] +\begin{pspicture}(-2,-4)(6,2) + \pstThreeDCoor[xMin=-4,yMin=-4,zMin=-4,xMax=2,zMax=2] + \pstPlanePut[plane=yz](-3,0,0){\fbox{\Huge\blue\textbf{yz plane}}} + \pstPlanePut[plane=yz](0,0,0){\fbox{\Huge\blue\textbf{yz plane}}} + \pstPlanePut[plane=yz](3,0,0){\fbox{\Huge\blue\textbf{yz plane}}} +\end{pspicture} +\end{LTXexample} + + +\bigskip +The following examples use the \Lkeyword{pOrigin} option to show that there are +still some problems with the xy-plane. +The second parameter is \Lkeyword{planecorr}. As first the values: + +\begin{description} + \item[\Lkeyval{off}]~Former and default behaviour; nothing will be changed. + This value is set, when parameter is missing. + \item[\Lkeyval{normal}]~Default correction, planes will be rotated to be readable. + \item[\Lkeyval{xyrot}]~Additionaly correction for $xy$ plane; bottom line of + letters will be set parallel to the $y$-axis. +\end{description} + +What kind off correction is ment? In the plots above labels for the $xy$ +plane and the $xz$ plane are mirrored. This is not a bug, it's \dots mathematics. + +\Lcs{pstPlanePut} puts the labels on the plane of it's value. That means, +\Lkeyset{plane=xy} puts the label on the $xy$ plane, so that the $x$ marks the +positive direction for the width, the $y$ for the height and the label +{\small{XY plane}} on the top side of plane. If you see the label mirrored, +you just look from the bottom side of plane \dots{} + +If you want to keep the labels readable for every view, i.\,e.\ for every +value of \Lkeyword{Alpha} and \Lkeyword{Beta}, you should set the value of the +parameter \Lkeyword{planecorr} to \Lkeyval{normal}; just like in next example: + +\medskip +\begin{LTXexample}[width=6cm] +\begin{pspicture}(-3,-2)(3,4) + \psset{pOrigin=lb} + \pstThreeDCoor[xMax=3.2,yMax=3.2,zMax=4] + \pstThreeDDot[drawCoor=true,linecolor=red](1,-1,2) + \pstPlanePut[plane=xy,planecorr=normal](1,-1,2) + {\fbox{\Huge\red\textbf{XY}}} + \pstThreeDDot[drawCoor=true,linecolor=green](1,3,1) + \pstPlanePut[plane=xz,planecorr=normal](1,3,1) + {\fbox{\Huge\green\textbf{XZ}}} + \pstThreeDDot[drawCoor=true,linecolor=blue](-1.5,0.5,3) + \pstPlanePut[plane=yz,planecorr=normal](-1.5,0.5,3) + {\fbox{\Huge\blue\textbf{YZ}}} +\end{pspicture} +\end{LTXexample} + +\medskip +But, why we have a third value \Lkeyval{xyrot} of \Lkeyword{planecorr}? +If there isn't an symmetrical view, -- just like in this example -- it +could be usefull to rotate the label for $xy$-plane, so that body line of +letters is parallel to the $y$ axis. It's done by setting +\Lkeyset{planecorr=xyrot}\,: + + +\medskip +\begin{LTXexample}[width=6cm] +\begin{pspicture}(-2,-2)(4,4) + \psset{pOrigin=lb} + \psset{Alpha=69.3,Beta=19.43} + \pstThreeDCoor[xMax=4,yMax=4,zMax=4] + \pstThreeDDot[drawCoor=true,linecolor=red](1,-1,2) + \pstPlanePut[plane=xy,planecorr=xyrot](1,-1,2) + {\fbox{\Huge\red\textbf{XY}}} + \pstThreeDDot[drawCoor=true,linecolor=green](1,3.5,1) + \pstPlanePut[plane=xz,planecorr=xyrot](1,3.5,1) + {\fbox{\Huge\green\textbf{XZ}}} + \pstThreeDDot[drawCoor=true,linecolor=blue](-2,1,3) + \pstPlanePut[plane=yz,planecorr=xyrot](-2,1,3) + {\fbox{\Huge\blue\textbf{YZ}}} +\end{pspicture} +\end{LTXexample} +% --- ende ------------------------------------------------------------ + + + +\psset{Alpha=45,xunit=1cm,yunit=1cm,xMin=-1,yMin=-1,zMin=-1} + +\section{Nodes} +The syntax is +\begin{BDef} +\Lcs{pstThreeDNode}\Largr{x,y,z}\Largb{node name} +\end{BDef} + +This node is internally a two dimensional node, so it cannot be used as a replacement for the +parameters \verb|(x,y,z)| of a 3D dot, which is possible with the \Lcs{psline} macro from +\LPack{pst-plot}: \verb|\psline{A}{B}|, where \verb|A| and \verb|B| are two nodes. It is still on +the to do list, that it may also be possible with \LPack{pst-3dplot}. On the other hand it is no +problem to define two 3D nodes \verb|C| and \verb|D| and then drawing a two dimensional line +from \verb|C| to \verb|D|. + +\section{Dots} +The syntax for a dot is +\begin{BDef} +\Lcs{pstThreeDDot}\OptArgs\Largr{x,y,z} +\end{BDef} +Dots can be drawn with dashed lines for the three coordinates, when the option \Lkeyword{drawCoor} is set to \verb|true|. It is also possible to draw an unseen dot +with the option \Lkeyset{dotstyle=none}. In this case the macro draws only the \Index{coordinates} +when the \Lkeyword{drawCoor} option is set to true. + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2)(2,2) + \pstThreeDCoor[xMin=-2,xMax=2,yMin=-2,yMax=2,zMin=-2,zMax=2] + \psset{dotstyle=*,dotscale=2,linecolor=red,drawCoor=true} + \pstThreeDDot(-1,1,1) + \pstThreeDDot(1.5,-1,-1) +\end{pspicture} +\end{LTXexample} + +In the following figure the coordinates of the dots are $(a,a,a)$ where a is $-2,-1,0,1,2$. + + +\begin{LTXexample}[width=5.25cm] +\begin{pspicture}(-3,-3.25)(2,3.25) + \psset{Alpha=30,Beta=60,dotstyle=square*,dotsize=3pt,% + linecolor=blue,drawCoor=true} + \pstThreeDCoor[xMin=-3,xMax=3,yMin=-3,yMax=3,zMin=-3,zMax=3] + \multido{\n=-2+1}{5}{\pstThreeDDot(\n,\n,\n)} +\end{pspicture} +\end{LTXexample} + + +\section{Lines} +The syntax for a three dimensional line is just like the same from \verb+\psline+ +\begin{BDef} +\Lcs{pstThreeDLine}\OptArgs\OptArg{\Larg{<arrow>}}\Largr{x1,y1,z1}\Largr{...}\Largr{xn,yn,zn} +\end{BDef} + +The option and arrow part are both optional and the number of points is only limited +to the memory. +All options for lines from \verb|pstricks| are possible, there are no special ones for a 3D line. There is no difference in drawing a line or a vector; the first one has an arrow of type "'\verb|-|"` and the second of "'\verb|->|"`. + +There is no special polygon macro, because you can get nearly the same with +\Lcs{pstThreeDLine}. + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2.25)(2,2.25) + \pstThreeDCoor[xMin=-2,xMax=2,yMin=-2,yMax=2,zMin=-2,zMax=2] + \psset{dotstyle=*,linecolor=red,drawCoor=true} + \pstThreeDDot(-1,1,0.5) + \pstThreeDDot(1.5,-1,-1) + \pstThreeDLine[linewidth=3pt,linecolor=blue,arrows=->]% + (-1,1,0.5)(1.5,-1,-1) +\end{pspicture} +\end{LTXexample} + + + + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2.25)(2,2.25) + \pstThreeDCoor[xMin=-2,xMax=2,yMin=-2,yMax=2,zMin=-2,zMax=2] + \psset{dotstyle=*,linecolor=red,drawCoor=true} + \pstThreeDDot(-1,1,1) + \pstThreeDDot(1.5,-1,-1) + \pstThreeDLine[linewidth=3pt,linecolor=blue](-1,1,1)(1.5,-1,-1) +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2.25)(2,2.25) + \psset{Alpha=30,Beta=60,dotstyle=pentagon*,dotsize=5pt,% + linecolor=red,drawCoor=true} + \pstThreeDCoor[xMin=-2,xMax=2,yMin=-2,yMax=2,zMin=-2,zMax=2] + \pstThreeDDot(-1,1,1) + \pstThreeDDot(1.5,-1,-1) + \pstThreeDLine[linewidth=3pt,linecolor=blue](-1,1,1)(1.5,-1,-1) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2.25)(2,2.25) + \psset{Alpha=30,Beta=-60} + \pstThreeDCoor[xMin=-2,xMax=2,yMin=-2,yMax=2,zMin=-2,zMax=2] + \pstThreeDDot[dotstyle=square,linecolor=blue,drawCoor=true](-1,1,1) + \pstThreeDDot[drawCoor=true](1.5,-1,-1) + \pstThreeDLine[linewidth=3pt,linecolor=blue](-1,1,1)(1.5,-1,-1) +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2.25)(2,2.25) + \psset{Alpha=30,Beta=-60} + \pstThreeDCoor[xMin=-2,xMax=2,yMin=-2,yMax=2,zMin=-2,zMax=2] + \pstThreeDDot[dotstyle=square,linecolor=blue,drawCoor=true](-1,1,1) + \pstThreeDDot[drawCoor=true](1.5,-1,-1) + \pstThreeDLine[linewidth=3pt,arrowscale=1.5,% + linecolor=magenta,linearc=0.5]{<->}(-1,1,1)(1.5,2,-1)(1.5,-1,-1) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-3,-2)(4,5)\label{lines} + \pstThreeDCoor[xMin=-3,xMax=3,yMin=-1,yMax=4,zMin=-1,zMax=3] + \multido{\iA=1+1,\iB=60+-10}{5}{% + \ifcase\iA\or\psset{linecolor=red}\or\psset{linecolor=green} + \or\psset{linecolor=blue}\or\psset{linecolor=cyan} + \or\psset{linecolor=magenta} + \fi + \pstThreeDLine[SphericalCoor=true,linewidth=3pt]% + (\iA,0,\iB)(\iA,30,\iB)(\iA,60,\iB)(\iA,90,\iB)(\iA,120,\iB)(\iA,150,\iB)% + (\iA,180,\iB)(\iA,210,\iB)(\iA,240,\iB)(\iA,270,\iB)(\iA,300,\iB)% + (\iA,330,\iB)(\iA,360,\iB)% + } + \multido{\iA=0+30}{12}{% + \pstThreeDLine[SphericalCoor=true,linestyle=dashed]% + (0,0,0)(1,\iA,60)(2,\iA,50)(3,\iA,40)(4,\iA,30)(5,\iA,20)} +\end{pspicture} +\end{LTXexample} + + +\section{Triangles} +A triangle is given with its three points: +\begin{BDef} +\Lcs{pstThreeDTriangle}\OptArgs\Largr{P1}\Largr{P2}\Largr{P3} +\end{BDef} + +When the option \Lkeyword{fillstyle} is set to another value than \Lkeyval{none} +the triangle is filled with the active color or with the one which is set with the option \Lkeyword{fillcolor}. + +\begin{LTXexample}[width=6.25cm] +\begin{pspicture}(-3,-4.25)(3,3.25) + \pstThreeDCoor[xMin=-4,xMax=4,yMin=-3,yMax=5,zMin=-4,zMax=3] + \pstThreeDTriangle[drawCoor=true,linecolor=black,% + linewidth=2pt](3,1,-2)(1,4,-1)(-2,2,0) + \pstThreeDTriangle[fillcolor=yellow,fillstyle=solid,% + linecolor=blue,linewidth=1.5pt](5,1,2)(3,4,-1)(-1,-2,2) +\end{pspicture} +\end{LTXexample} + +Especially for triangles the option \Lkeyword{linejoin} is important. The default value is $1$, which gives rounded edges. + +\begin{figure}[htb] +\centering +\psset{linewidth=0.2} +\begin{pspicture}(3,2.25) + \psline[linejoin=0](0,0)(1,2)(2,0)(3,2) +\end{pspicture}% +\hspace{0.4cm}% +\begin{pspicture}(4,2.25) + \psline[linejoin=1](0,0)(1,2)(2,0)(3,2)(4,0) +\end{pspicture}% +\hspace{0.4cm}% +\begin{pspicture}(3,2.25) + \psline[linejoin=2](0,0)(1,2)(2,0)(3,2) +\end{pspicture} +\caption{The meaning of the option \texttt{linejoin=0|1|2} for drawing lines} +\end{figure} + + +\section{Squares} +The syntax for a 3D square is: +\begin{BDef} +\Lcs{pstThreeDSquare}\OptArgs\Largr{vector o}\Largr{vec u}\Largr{vec v} +\end{BDef} + + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(-1,-1)(4,3) + \pstThreeDCoor[xMin=-3,xMax=1,yMin=-1,yMax=2,zMin=-1,zMax=3] + \psset{arrows=->,arrowsize=0.2,linecolor=blue,linewidth=1.5pt} + \pstThreeDLine[linecolor=green](0,0,0)(-2,2,3)\uput[45](1.5,1){$\vec{o}$} + \pstThreeDLine(-2,2,3)(2,2,3)\uput[0](3,2){$\vec{u}$} + \pstThreeDLine(-2,2,3)(-2,3,3)\uput[180](1,2){$\vec{v}$} +\end{pspicture} +\end{LTXexample} + +\medskip +Squares are nothing else than a polygon with the starting point $P_o$ given with the +origin \Index{vector} $\vec{o}$ and the two direction vectors $\vec{u}$ and $\vec{v}$, which build the sides of the \Index{square}. + + +\begin{LTXexample}[width=7.25cm] +\begin{pspicture}(-3,-2)(4,3) + \pstThreeDCoor[xMin=-3,xMax=3,yMin=-1,yMax=4,zMin=-1,zMax=3] + {\psset{fillcolor=blue,fillstyle=solid,drawCoor=true,dotstyle=*} + \pstThreeDSquare(-2,2,3)(4,0,0)(0,1,0)} +\end{pspicture} +\end{LTXexample} + + +\section{Boxes} +A box is a special case of a square and has the syntax + +\begin{BDef} +\Lcs{pstThreeDBox}\OptArgs\Largr{vector o}\Largr{vec u}\Largr{vec v}\Largr{vec w} +\end{BDef} + + +These are the origin vector $\vec{o}$ and three direction vectors $\vec{u}$, $\vec{v}$ and $\vec{w}$, +which are for example shown in the following figure. + + +\begin{LTXexample}[width=5.25cm] +\begin{pspicture}(-2,-1.25)(3,4.25) + \psset{Alpha=30,Beta=30} + \pstThreeDCoor[xMin=-3,xMax=1,yMin=-1,yMax=2,zMin=-1,zMax=4] + \pstThreeDDot[drawCoor=true](-1,1,2) + \psset{arrows=->,arrowsize=0.2} + \pstThreeDLine[linecolor=green](0,0,0)(-1,1,2) + \uput[0](0.5,0.5){$\vec{o}$} + \uput[0](0.9,2.25){$\vec{u}$} + \uput[90](0.5,1.25){$\vec{v}$} + \uput[45](2,1.){$\vec{w}$} + \pstThreeDLine[linecolor=blue](-1,1,2)(-1,1,4) + \pstThreeDLine[linecolor=blue](-1,1,2)(1,1,2) + \pstThreeDLine[linecolor=blue](-1,1,2)(-1,2,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=5.25cm] +\begin{pspicture}(-2,-1.25)(3,4.25) + \psset{Alpha=30,Beta=30} + \pstThreeDCoor[xMin=-3,xMax=1,yMin=-1,yMax=2,zMin=-1,zMax=4] + \pstThreeDBox[hiddenLine](-1,1,2)(0,0,2)(2,0,0)(0,1,0) + \pstThreeDDot[drawCoor=true](-1,1,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=5.25cm] +\begin{pspicture}(-2,-1.25)(3,4.25) + \psset{Alpha=210,Beta=30} + \pstThreeDCoor[xMin=-3,xMax=1,yMin=-1,yMax=2,zMin=-1,zMax=4] + \pstThreeDBox[hiddenLine](-1,1,2)(0,0,2)(2,0,0)(0,1,0) + \pstThreeDDot[drawCoor=true](-1,1,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=5.25cm] +\begin{pspicture}(-2,-1.25)(3,4.25) + \psset{Alpha=30,Beta=30} + \pstThreeDCoor[xMin=-3,xMax=1,yMin=-1,yMax=2,zMin=-1,zMax=4] + \pstThreeDBox[hiddenLine](-1,1,2)(0,0,2)(2,0,0)(0,1,0) + \pstThreeDDot[drawCoor=true](-1,1,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=5.25cm] +\begin{pspicture}(-2,-1.25)(3,4.25) + \psset{Alpha=130,Beta=30} + \pstThreeDCoor[xMin=-3,xMax=1,yMin=-1,yMax=2,zMin=-1,zMax=4] + \pstThreeDBox[hiddenLine](-1,1,2)(0,0,2)(2,0,0)(0,1,0) + \pstThreeDDot[drawCoor=true](-1,1,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=5.25cm] +\begin{pspicture}(-2,-1.25)(3,4.25) + \psset{Alpha=130,Beta=100} + \pstThreeDCoor[xMin=-3,xMax=1,yMin=-1,yMax=2,zMin=-1,zMax=4] + \pstThreeDBox[hiddenLine](-1,1,2)(0,0,2)(2,0,0)(0,1,0) + \pstThreeDDot[drawCoor=true](-1,1,2) +\end{pspicture} +\end{LTXexample} + + +\begin{BDef} +\Lcs{psBox}\OptArgs\Largr{vector o}\Largb{width}\Largb{depth}\Largb{height} +\end{BDef} + +The origin vector $\vec{o}$ determines the left corner of the box. + + +\begin{LTXexample}[width=6.25cm] +\begin{pspicture}(-3,-2)(3,5) +\psset{Alpha=2,Beta=10} +\pstThreeDCoor[zMax=5,yMax=7] + \psBox(0,0,0){2}{4}{3} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6.25cm] +\begin{pspicture}(-3,-3)(3,3) +\psset{Beta=50} +\pstThreeDCoor[xMax=3,zMax=6,yMax=6] + \psBox[showInside=false](0,0,0){2}{5}{3} +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[width=6.25cm] +\begin{pspicture}(-3,-4)(3,2) +\psset{Beta=40} +\pstThreeDCoor[zMax=3] + \psBox[RotY=20,showInside=false](0,0,0){2}{5}{3} +\end{pspicture} +\end{LTXexample} + + + +\begin{LTXexample}[width=6.25cm] +\psset{Beta=10,xyzLight=-7 3 4} +\begin{pspicture}(-3,-2)(3,4) +\pstThreeDCoor[zMax=5] +\psBox(0,0,0){2}{5}{3} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6.25cm] +\psset{Beta=10,xyzLight=-7 3 4} +\begin{pspicture}(-3,-2)(3,4) +\psset{Alpha=110} +\pstThreeDCoor[zMax=5] +\psBox(0,0,0){2}{5}{3} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6.25cm] +\psset{Beta=10,xyzLight=-7 3 4} +\begin{pspicture}(-3,-2)(3,3) +\psset{Alpha=200} +\pstThreeDCoor[zMax=3] +\psBox(0,0,0){2}{2}{3} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6.25cm] +\psset{Beta=10,xyzLight=-7 3 4} +\begin{pspicture}(-3,-2)(3,4) +\psset{Alpha=290} +\pstThreeDCoor[zMax=5] +\psBox(0,0,0){2}{5}{3} +\end{pspicture} +\end{LTXexample} + + + + +\section{Ellipses and circles} + +The equation for a two dimensional ellipse (figure \ref{fig:ellipse})is: +\begin{equation} +e:\frac{\left(x-x_{M}\right)^{2}}{a^{2}}+\frac{\left(y-y_{M}\right)^{2}}{b^{2}}=1 +\label{gl.600} +\end{equation} + +\begin{figure}[htb] +\centering +\begin{pspicture*}(-3,-1.5)(3,1.5) + \psset{unit=0.75cm} + \psline{->}(-3.5,0)(3.5,0) + \rput(3.3,-0.3){x}\psline{->}(0,-2.5)(0,2.5)\rput(-0.3,2.3){y} + \pscircle(-2,0){0.1}\pscircle(2,0){0.1} + \psline[linestyle=dotted,linewidth=0.5pt](-2,0)(0,2)(2,0) + \rput(-1.4,1){a}\rput(1.4,1){a} + \psline[linewidth=0.5pt,linearc=.25]% + (-3,0)(-3,-0.25)(-1.5,-0.25)% + (-1.5,-0.4)(-1.5,-0.25)(0,-0.25)(0,0) + \rput(-1.5,-0.7){a} + \psline[linewidth=0.5pt,linearc=.25]% + (0,2)(0.2,2)(0.2,1)(0.4,1)(0.2,1)(0.2,0)(0,0) + \rput(0.7,1){b} + \psellipse[linewidth=2pt](3,2) + \rput(-.4,-.4){M}\rput(2,-.4){$F_2$} + \rput(-2.2,0.4){$F_1$} + \rput(1,.2){e}\rput(-1,.2){e} + \rput(-1,-1){$r_1$}\rput(1.7,-1){$r_2$} + \psline[linestyle=dotted,linewidth=1pt]{->}(-2,0)(1,-1.8) + \psline[linestyle=dotted,linewidth=1pt]{<-}(1,-1.8)(2,0) +\end{pspicture*} +\caption{Definition of an Ellipse}\label{fig:ellipse} +\end{figure} + + + +$\left(x_m;y_m\right)$ is the center, $a$ +and $b$ the semi major and semi minor axes +respectively and $e$ the excentricity. For $a=b=1$ in equation~\ref{gl.600} we get the one for the circle, +which is nothing else than a special ellipse. +The equation written in the parameterform is + +\begin{equation}\label{gl601} +\begin{split} + x = a\cdot\cos\alpha\\ + y = b\cdot\sin\alpha +\end{split} +\end{equation} + +or the same with vectors to get an ellipse in a 3D system: +\begin{align}\label{gl.6} + e:\vec{x} &=\vec{m}+\cos\alpha\cdot\vec{u}+\sin\alpha\cdot\vec{v}\qquad 0\leq\alpha\leq360 +\end{align} + +where $\vec{m}$ is the center, $\vec{u}$ and $\vec{v}$ the directions vectors which are +perpendicular to each other. + + +\subsection{Options} +In addition to all possible options from \verb|pst-plot| there are two special +options to allow drawing of an arc (with predefined values for a full ellipse/circle): +% +\begin{verbatim} +beginAngle=0 +endAngle=360 +\end{verbatim} + +Ellipses and circles are drawn with the in section~\ref{subsec:parametricplotThreeD} described +\verb|parametricplotThreeD| macro with a default setting of $50$ points for a full ellipse/circle. + +\subsection{Ellipse} +It is very difficult to see in a 3D coordinate system the difference of an ellipse and a circle. Depending to the view point an ellipse maybe seen as a circle and vice versa. The syntax of the ellipse macro is: +\begin{BDef} +\Lcs{pstThreeDEllipse}\OptArgs\Largr{cx,cy,cz}\Largr{ux,uy,uz}\Largr{vx,vy,vz} +\end{BDef} + +where \verb|c| is for center and \verb|u| and \verb|v| for the two direction vectors. +The order of these two vectors is important for the drawing if it +is a left or right turn. It follows the right hand rule: flap the first vector $\vec{u}$ on the +shortest way into the second one $\vec{u}$, then you'll get the positive rotating. + + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-3,-2)(3,3) + \pstThreeDCoor[IIIDticks] + \psset{arrowscale=2,arrows=->} + \pstThreeDLine(0,0,0)(3,0,0)\pstThreeDLine(0,0,0)(0,3,0)\pstThreeDLine(0,0,0)(0,0,3) + \psset{linecolor=blue,linewidth=1.5pt,beginAngle=0,endAngle=90} + \pstThreeDEllipse(0,0,0)(3,0,0)(0,3,0) \pstThreeDEllipse(0,0,0)(0,0,3)(3,0,0) + \pstThreeDEllipse(0,0,0)(0,3,0)(0,0,3) +\end{pspicture}\hspace{2em} +\begin{pspicture}(-3,-2)(3,3) + \pstThreeDCoor[IIIDticks] + \psset{arrowscale=2,arrows=->} + \pstThreeDLine(0,0,0)(3,0,0)\pstThreeDLine(0,0,0)(0,3,0)\pstThreeDLine(0,0,0)(0,0,3) + \psset{linecolor=blue,linewidth=1.5pt,beginAngle=0,endAngle=90} + \pstThreeDEllipse(0,0,0)(0,3,0)(3,0,0) \pstThreeDEllipse(0,0,0)(3,0,0)(0,0,3) + \pstThreeDEllipse(0,0,0)(0,0,3)(0,3,0) +\end{pspicture} +\end{LTXexample} + + + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-2.25)(2,2.25) + \pstThreeDCoor[xMax=2,yMax=2,zMax=2] + \pstThreeDDot[linecolor=red,drawCoor=true](1,0.5,0.5) + \psset{linecolor=blue, linewidth=1.5pt} + \pstThreeDEllipse(1,0.5,0.5)(-0.5,1,0.5)(1,-0.5,-1) + \psset{beginAngle=0,endAngle=270,linecolor=green} + \pstThreeDEllipse(1,0.5,0.5)(-0.5,0.5,0.5)(0.5,0.5,-1) + \pstThreeDEllipse[RotZ=45,linecolor=red](1,0.5,0.5)(-0.5,0.5,0.5)(0.5,0.5,-1) +\end{pspicture} +\end{LTXexample} + + +\subsection{Circle} + +The circle is a special case of an ellipse (equ.~\ref{gl.6}) with the vectors +$\vec{u}$ and $\vec{v}$ which build the circle plain. They must not be +othogonal to each other. The circle macro takes the length of vector +$\vec{u}$ into account for the radius. The orthogonal part of vector $\vec{v}$ +is calculated internally +\begin{BDef} +\Lcs{pstThreeDCircle}\OptArgs\Largr{cx,cy,cz}\Largr{ux,uy,uz}\Largr{vx,vy,vz} +\end{BDef} + + +\begin{LTXexample}[width=4.25cm] +\begin{pspicture}(-2,-1.25)(2,2.25) + \pstThreeDCoor[xMax=2,yMax=2,zMax=2,linecolor=black] + \pstThreeDCircle[linestyle=dashed](1,1,0)(1,0,0)(3,4,0) + \pstThreeDCircle[linecolor=blue](1.6,1.6,1.7)(0.8,0.4,0.8)(0.8,-0.8,-0.4) + \pstThreeDDot[drawCoor=true,linecolor=blue](1.6,1.6,1.7) + \psset{linecolor=red,linewidth=2pt,plotpoints=20,showpoints=true} + \pstThreeDCircle(1.6,0.6,1.7)(0.8,0.4,0.8)(0.8,-0.8,-0.4) + \pstThreeDDot[drawCoor=true,linecolor=red](1.6,0.6,1.7) +\end{pspicture} +\end{LTXexample} + + +\begin{center} +\bgroup +\makebox[\linewidth]{% +\def\radius{4 }\def\PhiI{20 }\def\PhiII{50 } +% +\def\RadIs{\radius \PhiI sin mul} +\def\RadIc{\radius \PhiI cos mul} +\def\RadIIs{\radius \PhiII sin mul} +\def\RadIIc{\radius \PhiII cos mul} +\begin{pspicture}(-4,-4)(4,5) + \psset{Alpha=45,Beta=30,linestyle=dashed} + \pstThreeDCoor[linestyle=solid,xMin=-5,xMax=5,yMax=5,zMax=5,IIIDticks] + \pstThreeDEllipse[linecolor=red](0,0,0)(0,\radius,0)(0,0,\radius) + \pstThreeDEllipse(\RadIs,0,0)(0,\RadIc,0)(0,0,\RadIc) + \pstThreeDEllipse(\RadIIs,0,0)(0,\RadIIc,0)(0,0,\RadIIc) +% + \pstThreeDEllipse[linestyle=dotted,SphericalCoor](0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[SphericalCoor, + beginAngle=-90,endAngle=90](0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[linestyle=dotted,SphericalCoor](0,0,0)(\radius,90,\PhiII)(\radius,0,0) + \pstThreeDEllipse[SphericalCoor, + beginAngle=-90,endAngle=90](0,0,0)(\radius,90,\PhiII)(\radius,0,0) +% + \psset{linecolor=blue,arrows=->,arrowscale=2,linewidth=1.5pt,linestyle=solid} + \pstThreeDEllipse[SphericalCoor,beginAngle=\PhiI,endAngle=\PhiII]% + (0,0,0)(\radius,90,\PhiII)(\radius,0,0) + \pstThreeDEllipse[beginAngle=\PhiII,endAngle=\PhiI](\RadIIs,0,0)(0,\RadIIc,0)(0,0,\RadIIc) + \pstThreeDEllipse[SphericalCoor,beginAngle=\PhiII,endAngle=\PhiI]% + (0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[beginAngle=\PhiI,endAngle=\PhiII](\RadIs,0,0)(0,\RadIc,0)(0,0,\RadIc) +\end{pspicture} +\begin{pspicture}(-4,-4)(4,5) + \psset{Alpha=45,Beta=30,linestyle=dashed} + \pstThreeDCoor[linestyle=solid,xMin=-5,xMax=5,yMax=5,zMax=5,IIIDticks] + \pstThreeDEllipse[linecolor=red](0,0,0)(0,\radius,0)(0,0,\radius) + \pstThreeDEllipse(\RadIs,0,0)(0,\RadIc,0)(0,0,\RadIc) + \pstThreeDEllipse(\RadIIs,0,0)(0,\RadIIc,0)(0,0,\RadIIc) +% + \pstThreeDEllipse[linestyle=dotted,SphericalCoor](0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[SphericalCoor, + beginAngle=-90,endAngle=90](0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[linestyle=dotted,SphericalCoor](0,0,0)(\radius,90,\PhiII)(\radius,0,0) + \pstThreeDEllipse[SphericalCoor, + beginAngle=-90,endAngle=90](0,0,0)(\radius,90,\PhiII)(\radius,0,0) +% + \pscustom[fillstyle=solid,fillcolor=blue]{ + \pstThreeDEllipse[SphericalCoor,beginAngle=\PhiI,endAngle=\PhiII]% + (0,0,0)(\radius,90,\PhiII)(\radius,0,0) + \pstThreeDEllipse[beginAngle=\PhiII,endAngle=\PhiI](\RadIIs,0,0)(0,\RadIIc,0)(0,0,\RadIIc) + \pstThreeDEllipse[SphericalCoor,beginAngle=\PhiII,endAngle=\PhiI]% + (0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[beginAngle=\PhiI,endAngle=\PhiII](\RadIs,0,0)(0,\RadIc,0)(0,0,\RadIc) + } +\end{pspicture} +} +\egroup +\end{center} + +\begin{lstlisting} +\def\radius{4 }\def\PhiI{20 }\def\PhiII{50 } +% +\def\RadIs{\radius \PhiI sin mul} +\def\RadIc{\radius \PhiI cos mul} +\def\RadIIs{\radius \PhiII sin mul} +\def\RadIIc{\radius \PhiII cos mul} +\begin{pspicture}(-4,-4)(4,5) + \psset{Alpha=45,Beta=30,linestyle=dashed} + \pstThreeDCoor[linestyle=solid,xMin=-5,xMax=5,yMax=5,zMax=5,IIIDticks] + \pstThreeDEllipse[linecolor=red](0,0,0)(0,\radius,0)(0,0,\radius) + \pstThreeDEllipse(\RadIs,0,0)(0,\RadIc,0)(0,0,\RadIc) + \pstThreeDEllipse(\RadIIs,0,0)(0,\RadIIc,0)(0,0,\RadIIc) +% + \pstThreeDEllipse[linestyle=dotted,SphericalCoor](0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[SphericalCoor, + beginAngle=-90,endAngle=90](0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[linestyle=dotted,SphericalCoor](0,0,0)(\radius,90,\PhiII)(\radius,0,0) + \pstThreeDEllipse[SphericalCoor, + beginAngle=-90,endAngle=90](0,0,0)(\radius,90,\PhiII)(\radius,0,0) +% + \psset{linecolor=blue,arrows=->,arrowscale=2,linewidth=1.5pt,linestyle=solid} + \pstThreeDEllipse[SphericalCoor,beginAngle=\PhiI,endAngle=\PhiII]% + (0,0,0)(\radius,90,\PhiII)(\radius,0,0) + \pstThreeDEllipse[beginAngle=\PhiII,endAngle=\PhiI](\RadIIs,0,0)(0,\RadIIc,0)(0,0,\RadIIc) + \pstThreeDEllipse[SphericalCoor,beginAngle=\PhiII,endAngle=\PhiI]% + (0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[beginAngle=\PhiI,endAngle=\PhiII](\RadIs,0,0)(0,\RadIc,0)(0,0,\RadIc) +\end{pspicture} +\begin{pspicture}(-4,-4)(4,5) + +[ ... ] + + \pstThreeDEllipse[linestyle=dotted,SphericalCoor](0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[SphericalCoor, + beginAngle=-90,endAngle=90](0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[linestyle=dotted,SphericalCoor](0,0,0)(\radius,90,\PhiII)(\radius,0,0) + \pstThreeDEllipse[SphericalCoor, + beginAngle=-90,endAngle=90](0,0,0)(\radius,90,\PhiII)(\radius,0,0) +% + \pscustom[fillstyle=solid,fillcolor=blue]{ + \pstThreeDEllipse[SphericalCoor,beginAngle=\PhiI,endAngle=\PhiII]% + (0,0,0)(\radius,90,\PhiII)(\radius,0,0) + \pstThreeDEllipse[beginAngle=\PhiII,endAngle=\PhiI](\RadIIs,0,0)(0,\RadIIc,0)(0,0,\RadIIc) + \pstThreeDEllipse[SphericalCoor,beginAngle=\PhiII,endAngle=\PhiI]% + (0,0,0)(\radius,90,\PhiI)(\radius,0,0) + \pstThreeDEllipse[beginAngle=\PhiI,endAngle=\PhiII](\RadIs,0,0)(0,\RadIc,0)(0,0,\RadIc) + } +\end{pspicture} +\end{lstlisting} + +% --------------------------------------------------------------------------------------- +\section{\Lcs{pstIIIDCylinder}} +% --------------------------------------------------------------------------------------- +The syntax is + +\begin{BDef} +\Lcs{pstIIIDCylinder}\OptArgs\Largr{x,y,z}\Largb{radius}\Largb{height} +\end{BDef} + +\verb+(x,y,z)+ defines the center of the lower part of the cylinder. If it is +missing, then \verb+(0,0,0)+ are taken into account. + +\begin{LTXexample}[width=6.5cm] +\psframebox{% +\begin{pspicture}(-3.5,-2)(3,6) +\pstThreeDCoor[zMax=6] +\pstIIIDCylinder{2}{5} +\end{pspicture} +} +\end{LTXexample} + +\begin{LTXexample}[width=6.5cm] +\psframebox{% +\begin{pspicture}(-3.5,-2)(3,6.75) +\pstThreeDCoor[zMax=7] +\pstIIIDCylinder[RotY=30,fillstyle=solid, + fillcolor=red!20,linecolor=black!60](0,0,0){2}{5} +\end{pspicture} +} +\end{LTXexample} + +\begin{LTXexample}[width=6.5cm] +\psframebox{% +\begin{pspicture}(-3.2,-1.75)(3,6.25) +\pstThreeDCoor[zMax=7] +\pstIIIDCylinder[linecolor=black!20, + increment=0.4,fillstyle=solid]{2}{5} +\psset{linecolor=red} +\pstThreeDLine{->}(0,0,5)(0,0,7) +\end{pspicture} +} +\end{LTXexample} + +\begin{LTXexample}[width=7.5cm] +\psframebox{% +\begin{pspicture}(-4.5,-1.5)(3,6.8) +\psset{Beta=20} +\pstThreeDCoor[zMax=7] +\pstIIIDCylinder[fillcolor=blue!20, + RotX=45](1,1,0){2}{5} +\end{pspicture} +} +\end{LTXexample} + + + +% --------------------------------------------------------------------------------------- +\section{\nxLcs{psCylinder}} +% --------------------------------------------------------------------------------------- +The syntax is + +\begin{BDef} +\Lcs{psCylinder}\OptArgs\Largr{x,y,z}\Largb{radius}\Largb{height} +\end{BDef} + +\verb+(x,y,z)+ defines the center of the lower part of the cylinder. If it is +missing, then \verb+(0,0,0)+ are taken into account. With \Lkeyval{increment} for +the angle step and \Lkeyword{Hincrement} for the height step, the number of +segemnts can be defined. They are preset to 10 and 0.5. + +\begin{LTXexample}[width=7cm] +\begin{pspicture}(-3,-2)(3,7) +\psset{Beta=10} +\pstThreeDCoor[zMax=7] + \psCylinder[increment=5]{2}{5} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=7cm] +\begin{pspicture}(-3,-2)(3,2) +\psset{Beta=10} +\pstThreeDCoor[zMax=1] + \psCylinder[increment=5,Hincrement=0.1]{2}{0.5} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=7cm] +\begin{pspicture}(-3,-2)(3,6) +\psset{Beta=60} +\pstThreeDCoor[zMax=9] + \psCylinder[RotX=10,increment=5]{3}{5} + \pstThreeDLine[linecolor=red](0,0,0)(0,0,8.5) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=7cm] +\begin{pspicture}(-3,-2)(3,6) +\psset{Beta=60} +\pstThreeDCoor[zMax=9] + \psCylinder[RotX=10,RotY=45,showInside=false]{2}{5} + \pstThreeDLine[linecolor=red](0,0,0)(0,0,8.5) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=7cm] +\begin{pspicture}(-3,-2)(3,6) +\psset{Beta=60} +\pstThreeDCoor[zMax=9] + \psCylinder[RotY=-45](0,1,0){2}{5} +\end{pspicture} +\end{LTXexample} + + +\clearpage + +% --------------------------------------------------------------------------------------- +\section{\Lcs{pstParaboloid}} +% --------------------------------------------------------------------------------------- +The syntax is + +\begin{BDef} +\Lcs{pstParaboloid}\OptArgs\Largb{height}\Largb{radius} +\end{BDef} + +\Larg{height} and \Larg{radius} depend to each other, it is the radius of the circle +at the height. By default the paraboloid is placed in the origin of coordinate system, but +with \Lcs{pstThreeDput} it can be placed anywhere. The possible options are listed in +table~\ref{tab:paraboloid}. +The segment color must be set as a cmyk color \verb|SegmentColor={[cmyk]{c,m,y,k}}| in parenthesis, +otherwise \LPack{xcolor} cannot read the values. A white color is given by \verb|SegmentColor={[cmyk]{0,0,0,0}}|. + +\begin{table}[htb] +\centering +\caption{Options for the \Lcs{pstParaboloid} macro}\label{tab:paraboloid} +\smallskip +\begin{tabular}{l|l} +\textbf{Option name} & \textbf{value}\\\hline +\verb|SegmentColor| & cmyk color for the segments (0.2,0.6,1,0)\\ +\verb|showInside| & show inside (true)\\ +\verb|increment| & number for the segments (10) +\end{tabular} +\end{table} + + + +% x=radius/sqrt(h)*V*cos(V) +% y=radius/sqrt(h)*V*sin(V) +% z=radius/sqrt(h)*V*V +\begin{LTXexample}[width=4cm] +\begin{pspicture}(-2,-1)(2,5) +\pstThreeDCoor[xMax=2,yMax=2,zMin=0,zMax=6,IIIDticks]% +\pstParaboloid{5}{1}% Hoehe 5 und Radius 1 +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=.65\linewidth,wide] +\begin{pspicture}(-.25\linewidth,-1)% + (.25\linewidth,7.5) +\pstParaboloid[showInside=false, + SegmentColor={[cmyk]{0.8,0.1,.11,0}}]{4}{5}% +\pstThreeDCoor[xMax=3,yMax=3, + zMax=7.5,IIIDticks] +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[width=9cm,wide] +\begin{pspicture}(0,-3)(7,5) +\pstThreeDCoor[xMax=2,yMax=13,zMin=0,zMax=6,IIIDticks]% +\multido{\rA=2.0+2.5, + \rB=0.15+0.20}{5}{% + \pstParaboloid[% + SegmentColor={[cmyk]% + {\rB,0.1,0.11,0.1}}]% + (0,\rA,0){5}{1}}% height 5 and radius 1 +\pstThreeDLine[linestyle=dashed]{->}(0,0,5)(0,13,5) +\end{pspicture} +\end{LTXexample} + + +\clearpage +\section{Spheres}\label{sec:spheres} + +\begin{LTXexample}[width=6.25cm] +\begin{pspicture}(-4,-2.25)(2,4.25) + \pstThreeDCoor[xMin=-3,yMax=2] + \pstThreeDSphere(1,-1,2){2} + \pstThreeDDot[dotstyle=x,linecolor=red,drawCoor=true](1,-1,2) +\end{pspicture} +\end{LTXexample} + +\begin{BDef} +\Lcs{pstThreeDSphere}\OptArgs\Largr{x,y,z}\Largb{Radius} +\end{BDef} + +\Largr{x,y,z} is the center of the sphere and possible options are listed in table~\ref{tab:sphereOptions}. +The segment color must be set as a cmyk color \Lkeyword{SegmentColor}\verb|={[cmyk]{c,m,y,k}}| in parenthesis, +otherwise \LPack{xcolor} cannot read the values. A white color is given by \Lkeyword{SegmentColor}\verb|={[cmyk]{0,0,0,0}}|. + +\begin{table}[htb] +\centering +\caption{Options for the sphere macro}\label{tab:sphereOptions} +\smallskip +\begin{tabular}{l|l} +\textbf{Option name} & \textbf{value}\\\hline +\verb|SegmentColor| & cmyk color for the segments (0.2,0.6,1,0)\\ +\verb|increment| & number for the segments (10) +\end{tabular} +\end{table} + + +\begin{LTXexample}[width=6.25cm] +\begin{pspicture}(-4,-2.25)(2,4.25) + \pstThreeDCoor[xMin=-3,yMax=2] + \pstThreeDSphere[SegmentColor={[cmyk]{0,0,0,0}}](1,-1,2){2} + \pstThreeDDot[dotstyle=x,linecolor=red,drawCoor=true](1,-1,2) +\end{pspicture} +\end{LTXexample} + + + +\section{Mathematical functions} +There are two macros for plotting mathematical functions, which work similiar to the one from \LPack{pst-plot}. + +\subsection{Function $f(x,y)$} + +The macro for plotting functions does not have the same syntax as the one from +\LPack{pst-plot}~\cite{dtk02.1:voss:mathematischen}, but it is used in the same way: + +\begin{BDef} +\Lcs{psplotThreeD}\OptArgs\Largr{xMin,xMax}\Largr{yMin,yMax}\Largb{the function} +\end{BDef} + +The function has to be written in \PS{} code and the only valid variable names are $x$ +and $y$, f.ex: \verb|{x dup mul y dup mul add sqrt}| for the math expression $\sqrt{x^2 + y^2}$. +The macro has the same plotstyle options as \Lcs{psplot}, except the \Lkeyword{plotpoints}-option which is +split into one for $x$ and one for $y$ (table~\ref{tab:lineOptions}). + +\begin{table}[htb] +\centering +\caption{Options for the plot Macros}\label{tab:lineOptions} +\smallskip +\begin{tabular}{l|l} +\textbf{Option name} & \textbf{value}\\\hline +\verb|plotstyle| & + \verb|dots|\\ +& \verb|line|\\ +& \verb|polygon|\\ +& \verb|curve|\\ +& \verb|ecurve|\\ +& \verb|ccurve|\\ +& \verb|none| (default)\\ +\verb|showpoints| & default is false\\ +\verb|xPlotpoints| & default is $25$\\ +\verb|yPlotpoints| & default is $25$\\ +\verb|drawStyle| & default is \verb|xLines|\\ +& \verb|yLines|\\ +& \verb|xyLines|\\ +& \verb|yxLines|\\ +\verb|hiddenLine| & default is false\\ +\verb|algebraic| & default is false +\end{tabular} +\end{table} + +The equation \ref{eq:3dfunc} is plotted with the following parameters and seen in figure \ref{fig:3dfunc}. + +\begin{align}\label{eq:3dfunc} +z&=10\left(x^3+xy^4-\frac{x}{5}\right)e^{-\left(x^2+y^2\right)}+ + e^{-\left((x-1.225)^2+y^2\right)} +\end{align} + + +The function is calculated within two loops: +{\small\begin{verbatim} +for (float y=yMin; y<yMax; y+=dy) + for (float x=xMin; x<xMax; x+=dx) + z=f(x,y); +\end{verbatim}} + +It depends to the inner loop in which direction the curves are drawn. There are four possible +values for the option \Lkeyword{drawStyle}: +\begin{itemize} +\item \Lkeyval{xLines} (default) Curves are drawn in x direction +\item \Lkeyval{yLines} Curves are drawn in y direction +\item \Lkeyval{xyLines} Curves are first drawn in x and then in y direction +\item \Lkeyval{yxLines} Curves are first drawn in y and then in x direction +\end{itemize} + +In fact of the inner loop it is only possible to get a closed curve in the defined direction. +For lines in x direction less \Lkeyword{yPlotpoints} are no problem, in difference to +\Lkeyword{xPlotpoints}, especially for the plotstyle options \Lkeyval{line} and \Lkeyval{dots}. + +Drawing three dimensional functions with curves which are transparent makes it difficult +to see if a point is before or behind another one. \Lcs{psplotThreeD} has an option +\Lkeyword{hiddenLine} for a primitive hidden line mode, which only works when the y-intervall +is defined in a way that $y_2>y_1$. Then every new curve is plotted over the forgoing one +and filled with the color white. Figure~\ref{fig:3dfunc-hidden} is the same as +figure~\ref{fig:3dfunc}, only with the option \Lkeyword{hiddenLine}. + +\begin{lstlisting} +\begin{pspicture}(-6,-4)(6,5) + \psset{Beta=15} + \psplotThreeD[plotstyle=line,drawStyle=xLines,% is the default anyway + yPlotpoints=50,xPlotpoints=50,linewidth=1pt](-4,4)(-4,4){% + x 3 exp x y 4 exp mul add x 5 div sub 10 mul + 2.729 x dup mul y dup mul add neg exp mul + 2.729 x 1.225 sub dup mul y dup mul add neg exp add} + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] +\end{pspicture} +\end{lstlisting} + + +\begin{figure*} +\centering +\begin{pspicture}(-6,-4)(6,5) + \psset{Beta=15} + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] + \psplotThreeD[ + algebraic, + plotstyle=curve, + yPlotpoints=50,xPlotpoints=50, + linewidth=0.5pt](-4,4)(-4,4){10*(x^3+x*y^4-x/5)*Euler^(-x^2-y^2)+Euler^(-((x-1.225)^2+y^2))} +\end{pspicture} +\caption{Plot of the equation \ref{eq:3dfunc}}\label{fig:3dfunc} +\end{figure*} + + +\begin{figure*} +\centering +\begin{pspicture}(-6,-4)(6,5) + \psset{Alpha=45,Beta=15} + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] + \psplotThreeD[% + plotstyle=curve,% + yPlotpoints=50,xPlotpoints=50,% + linewidth=0.5pt,hiddenLine=true](-4,4)(-4,4){% + x 3 exp x y 4 exp mul add x 5 div sub 10 mul + 2.729 x dup mul y dup mul add neg exp mul + 2.729 x 1.225 sub dup mul y dup mul add neg exp add} +\end{pspicture} +\caption{Plot of the equation \ref{eq:3dfunc} with the \texttt{hiddenLine=true} option}\label{fig:3dfunc-hidden} +\end{figure*} + + + +\begin{figure*} +\centering +\begin{pspicture}(-6,-4)(6,5) + \psset{Alpha=45,Beta=15} + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] + \psplotThreeD[% + plotstyle=line,% + drawStyle=yLines,% + yPlotpoints=50,xPlotpoints=50,% + linewidth=0.2pt](-4,4)(-4,4){% + x 3 exp x y 4 exp mul add x 5 div sub 10 mul + 2.729 x dup mul y dup mul add neg exp mul + 2.729 x 1.225 sub dup mul y dup mul add neg exp add} +\end{pspicture} +\caption{Plot of the equation \ref{eq:3dfunc} with the \texttt{drawStyle=yLines} option} +\end{figure*} + +\begin{figure*} +\centering +\begin{pspicture}(-6,-4)(6,5) + \psset{Alpha=45,Beta=15} + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] + \psplotThreeD[% + plotstyle=curve,% + drawStyle=yLines,% + hiddenLine=true,% + yPlotpoints=50,xPlotpoints=50,% + linewidth=0.2pt](-4,4)(-4,4){% + x 3 exp x y 4 exp mul add x 5 div sub 10 mul + 2.729 x dup mul y dup mul add neg exp mul + 2.729 x 1.225 sub dup mul y dup mul add neg exp add} +\end{pspicture} +\caption{Plot of the equation \ref{eq:3dfunc} with the \texttt{drawStyle=yLines} and +\texttt{hiddenLine=true} option} +\end{figure*} + + + + +\begin{figure*} +\centering +\begin{pspicture}(-6,-4)(6,5) + \psset{Alpha=45,Beta=15} + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] + \psplotThreeD[% + plotstyle=line,% + drawStyle=xyLines,% + yPlotpoints=50,xPlotpoints=50,% + linewidth=0.2pt](-4,4)(-4,4){% + x 3 exp x y 4 exp mul add x 5 div sub 10 mul + 2.729 x dup mul y dup mul add neg exp mul + 2.729 x 1.225 sub dup mul y dup mul add neg exp add} +\end{pspicture} +\caption{Plot of the equation \ref{eq:3dfunc} with the \texttt{drawStyle=xyLines} option} +\end{figure*} + +\begin{figure*}[htbp] +\centering +\begin{pspicture}(-6,-4)(6,5) + \psset{Alpha=45,Beta=15} + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] + \psplotThreeD[% + plotstyle=curve,% + drawStyle=xLines,% + hiddenLine=true,% + yPlotpoints=50,xPlotpoints=50,% + linewidth=0.2pt](-4,4)(-4,4){% + x 3 exp x y 4 exp mul add x 5 div sub 10 mul + 2.729 x dup mul y dup mul add neg exp mul + 2.729 x 1.225 sub dup mul y dup mul add neg exp add} +\end{pspicture} +\caption{Plot of the equation \ref{eq:3dfunc} with the \texttt{drawStyle=xLines} and +\texttt{hiddenLine=true} option} +\end{figure*} + +\begin{figure*}[htbp] +\centering +\begin{pspicture}(-6,-4)(6,5) + \psset{Alpha=45,Beta=15} + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] + \psplotThreeD[ + plotstyle=curve, + drawStyle=yLines, + fillstyle=gradient, + yPlotpoints=50,xPlotpoints=50, + linewidth=0.2pt](-4,4)(-4,4){ + x 3 exp x y 4 exp mul add x 5 div sub 10 mul + 2.729 x dup mul y dup mul add neg exp mul + 2.729 x 1.225 sub dup mul y dup mul add neg exp add} +\end{pspicture} +\caption{Plot of the equation \ref{eq:3dfunc} with the \texttt{drawStyle=yLines} and +\texttt{hiddenLine=true} option} +\end{figure*} + + + +\subsection{Parametric Plots}\label{subsec:parametricplotThreeD} +Parametric plots are only possible for drawing curves or areas. The syntax for this plot macro is: +\begin{BDef} +\Lcs{parametricplotThreeD}\OptArgs\Largr{t1,t2}\Largr{u1,u2}\Largb{three parametric functions x y z} +\end{BDef} + +The only possible variables are $t$ and $u$ with $t1,t2$ and $u1,u2$ as the +range for the parameters. The order for the functions is not important and $u$ may be +optional when having only a three dimensional curve and not an area. +\begin{align} +\begin{array}{rl} + x & =f(t,u)\\ + y & =f(t,u)\\ + z & =f(t,u) +\end{array} +\end{align} +To draw a spiral we have the parametric functions: +\begin{align} +\begin{array}{rl} + x & = r \cos t\\ + y & = r \sin t\\ + z & = t/600 +\end{array} +\end{align} + +In the example the $t$ value is divided by $600$ for the $z$ coordinate, because we have the +values for $t$ in degrees, here with a range of $0\mbox{\textdegree}\ldots 2160\mbox{\textdegree}$. Drawing a curve in +a three dimensional coordinate system does only require one parameter, which has to be by default +$t$. In this case we do not need all parameters, so that one can write + +\begin{BDef} +\Lcs{parametricplotThreeD}\OptArgs\Largr{t1,t2}\Largb{three parametric functions x y z} +\end{BDef} + +which is the same as \verb|(0,0)| for the parameter $u$. + +\begin{LTXexample}[width=6.75cm] +\begin{pspicture}(-3.25,-2.25)(3.25,5.25) + \pstThreeDCoor[zMax=5] + \parametricplotThreeD[xPlotpoints=200, + linecolor=blue,% + linewidth=1.5pt,plotstyle=curve](0,2160){% + 2.5 t cos mul 2.5 t sin mul t 600 div}%degrees +\end{pspicture} +\end{LTXexample} + +And the same with the algebraic option: + +\begin{LTXexample}[width=6.75cm] +\begin{pspicture}(-3.25,-2.25)(3.25,5.25) + \pstThreeDCoor[zMax=5] + \parametricplotThreeD[xPlotpoints=200, + linecolor=blue,% + linewidth=1.5pt,plotstyle=curve, + algebraic](0,18.86){% radiant + 2.5*cos(t) | 2.5*sin(t) | t/5.24} +\end{pspicture} +\end{LTXexample} + + +Instead of using the \Lcs{pstThreeDSphere} macro (see section \ref{sec:spheres}) it is also +possible to use parametric functions for a sphere. The macro plots continous lines only for +the $t$ parameter, so a sphere plotted with the longitudes need the parameter equations as +\begin{align} +\begin{array}{l} +x = \cos t \cdot \sin u\\ +y = \cos t \cdot \cos u\\ +z = \sin t +\end{array} +\end{align} + +The same is possible for a sphere drawn with the latitudes: +\begin{align} +\begin{array}{l} +x = \cos u \cdot \sin t\\ +y = \cos u \cdot \cos t\\ +z = \sin u +\end{array} +\end{align} + +and at last both together is also not a problem when having these parametric functions together in one +\Lenv{pspicture} environment (see figure \ref{fig:paraSpheres}). + +\begin{lstlisting} +\begin{pspicture}(-1,-1)(1,1) +\parametricplotThreeD[plotstyle=curve,yPlotpoints=40](0,360)(0,360){% + t cos u sin mul t cos u cos mul t sin +} +\parametricplotThreeD[plotstyle=curve,yPlotpoints=40](0,360)(0,360){% + u cos t sin mul u cos t cos mul u sin +} +\end{pspicture} +\end{lstlisting} + + +\begin{figure}[htbp] +{\psset{xunit=1.75cm,yunit=1.75cm} +\begin{pspicture}(-1,-1)(1,1) +\setIIIDplotDefaults +%\pstThreeDCoor[xMin=-1,xMax=1,yMin=-1,yMax=1,zMin=-1,zMax=1] +\parametricplotThreeD[plotstyle=curve](0,360)(0,360){% + t cos u sin mul + t cos u cos mul + t sin +} +\end{pspicture}\hfill% +\begin{pspicture}(-1,-1)(1,1) + +%\pstThreeDCoor[xMin=-1,xMax=1,yMin=-1,yMax=1,zMin=-1,zMax=1] +\parametricplotThreeD[plotstyle=curve](0,360)(0,360){% + u cos t sin mul + u cos t cos mul + u sin +} +\end{pspicture}}\hfill +{\psset{xunit=2.5cm,yunit=2.5cm} +\begin{pspicture}(-1,-1)(1,1) + +\pstThreeDCoor[xMin=-1,xMax=1,yMin=-1,yMax=1,zMin=-1,zMax=1] +\parametricplotThreeD[plotstyle=curve](0,360)(0,360){% + t cos u sin mul + t cos u cos mul + t sin +} +\parametricplotThreeD[plotstyle=curve](0,360)(0,360){% + u cos t sin mul + u cos t cos mul + u sin +} +\end{pspicture}} +\caption{Different Views of the same Parametric Functions}\label{fig:paraSpheres} +\end{figure} + + + +\section{Plotting data files} +There are the same conventions for data files which holds 3D coordinates, than for the 2D one. For example: +\begin{verbatim} + 0.0000 1.0000 0.0000 +-0.4207 0.9972 0.0191 +.... + +0.0000, 1.0000, 0.0000 +-0.4207, 0.9972, 0.0191 +.... + +(0.0000,1.0000,0.0000) +(-0.4207,0.9972,0.0191) +.... + +{0.0000,1.0000,0.0000} +{-0.4207,0.9972,0.0191} +.... +\end{verbatim} + +There are the same three plot functions: +\begin{BDef} +\Lcs{fileplotThreeD}\OptArgs\Largb{<datafile>}\\ +\Lcs{dataplotThreeD}\OptArgs\Largb{data object}\\ +\Lcs{listplotThreeD}\OptArgs\Largb{data object} +\end{BDef} + +The in the following examples used data file has 446 entries like + +\begin{verbatim} +6.26093349..., 2.55876582..., 8.131984... +\end{verbatim} + +This may take some time on slow machines when using the \Lcs{listplotThreeD} macro. +The possible options for the lines are the ones from table~\ref{tab:lineOptions}. + +\subsection{\textbackslash\texttt{fileplotThreeD}} +The syntax is very easy + +\begin{BDef} +\Lcs{fileplotThreeD}\OptArgs\Largb{datafile} +\end{BDef} + +If the data file is not in the same directory than the document, insert the file name +with the full path. Figure~\ref{fig:fileplot} shows a file plot with the +option \Lkeyset{linestyle=line}. + + +\begin{figure}[!htbp] +\begin{LTXexample}[pos=t] +\begin{pspicture}(-6,-3)(6,10) + \psset{xunit=0.5cm,yunit=0.75cm,Alpha=30,Beta=30}% the global parameters + \pstThreeDCoor[xMin=-10,xMax=10,yMin=-10,yMax=10,zMin=-2,zMax=10] + \fileplotThreeD[plotstyle=line]{data3D.Roessler} +\end{pspicture}% +\end{LTXexample}% +\caption{Demonstration of \Lcs{fileplotThreeD} with \texttt{Alpha=30} and \texttt{Beta=15}}\label{fig:fileplot} +\end{figure} + + +\subsection{\Lcs{dataplotThreeD}} +The syntax is + +\begin{BDef} +\Lcs{dataplotThreeD}\OptArgs\Largb{data object} +\end{BDef} + +In difference to the macro \Lcs{fileplotThreeD} the \Lcs{dataplotThreeD} cannot plot any external data +without reading this with the macro \Lcs{readdata} which reads external data and save it in a macro, +f.ex.: \Lcs{dataThreeD}.\cite{dtk02.2:jackson.voss:plot-funktionen} + +\begin{BDef} +\Lcs{readdata}\Largb{data object}\Largb{datafile} +\end{BDef} + +\readdata{\dataThreeD}{data3D.Roessler} +\begin{figure}[htbp] +\begin{LTXexample}[width=8.5cm] +\begin{pspicture}(-4.5,-3.5)(4,11) + \psset{xunit=0.5cm,yunit=0.75cm,Alpha=-30} + \pstThreeDCoor[xMin=-10,xMax=10,yMin=-10,yMax=10,zMin=-2,zMax=10] + \dataplotThreeD[plotstyle=line]{\dataThreeD} +\end{pspicture}% +\end{LTXexample} +\caption{Demonstration of \texttt{\textbackslash dataplotThreeD} with \texttt{Alpha=-30} and +\texttt{Beta=30}}\label{fig:fileplot} +\end{figure} + + +\subsection{\Lcs{listplotThreeD}} +The syntax is +\begin{BDef} +\Lcs{listplotThreeD}\OptArgs\Largb{data object} +\end{BDef} + +\Lcs{listplotThreeD} ist similiar to \Lcs{dataplotThreeD}, so it cannot plot any external data in a +direct way, too. But \Lcs{readdata} reads external data and saves +it in a macro, f.ex.: \Lcs{dataThreeD}.\cite{dtk02.2:jackson.voss:plot-funktionen} \Lcs{listplot} +can handle some additional PostScript code, which can be appended to the data object, f.ex.: + +\readdata{\data}{data3D.Roessler} +\newcommand{\dataThreeDDraft}{% + \data\space + gsave % save grafic status + /Helvetica findfont 40 scalefont setfont + 45 rotate % rotate 45 degrees + 0.9 setgray % 1 ist white + -60 30 moveto (DRAFT) show + grestore +} + +\begin{lstlisting} +\dataread{\data}{data3D.Roessler} +\newcommand{\dataThreeDDraft}{% + \data\space + gsave % save grafic status + /Helvetica findfont 40 scalefont setfont + 45 rotate % rotate 45 degrees + 0.9 setgray % 1 ist white + -60 30 moveto (DRAFT) show + grestore +} +\end{lstlisting} + +\begin{figure}[htb] +\begin{LTXexample}[pos=t] +\begin{pspicture}(-5,-4)(5,4) + \psset{xunit=0.5cm,yunit=0.5cm,Alpha=0,Beta=90} + \pstThreeDCoor[xMin=-10,xMax=10,yMin=-10,yMax=7.5,zMin=-2,zMax=10] + \listplotThreeD[plotstyle=line]{\dataThreeDDraft} +\end{pspicture}% +\end{LTXexample}% +\caption{Demonstration of \texttt{\textbackslash listplotThreeD} with a view from above +(\texttt{Alpha=0} and \texttt{Beta=90}) and some additional PostScript +code}\label{fig:listplot} +\end{figure} + +Figure \ref{fig:listplot} shows what happens with this code. For another +example see \cite{dtk02.1:voss:mathematischen}, where the macro \Lcs{ScalePoints} +is modified. This macro is in \LPack{pst-3dplot} called \Lcs{ScalePointsThreeD}. + +\section{Utility macros} + +\subsection{Rotation of three dimensional coordinates} + +With the three optional arguments \Lkeyword{RotX}, \Lkeyword{RotY} and \Lkeyword{RotZ} one can rotate a three dimensional +point. This makes only sense when one wants to save the coordinates. In general it is more +powerful to use directly the optional parameters \Lkeyword{RotX}, \Lkeyword{RotY}, \Lkeyword{RotZ} for +the plot macros. However, the macro syntax is +% +\begin{BDef} +\Lcs{pstRotPOintIIID}\OptArg{RotX=...,RotY=...,RotZ=...}\Largr{x,y,z}\nxLcs{xVal}\nxLcs{yVal}\nxLcs{zVal} +\end{BDef} + +the \verb+\xVal \yVal \zVal+ hold the new rotated coordinates and must be defined by the user like \verb+\def\xVal{}+, +where the name of the macro is not important. + +The rotation angles are all predefined to $0$ degrees. + +\begin{center} +\def\xVal{}\def\yVal{}\def\zVal{} +\begin{pspicture}(-6,-4)(6,5) + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] + \multido{\iA=0+10}{36}{\pstRotPointIIID[RotX=\iA](2,0,3){\xVal}{\yVal}{\zVal} + \pstThreeDDot[drawCoor=true](\xVal,\yVal,\zVal) + } +\end{pspicture} + +\label{exa:nameX}\label{exa:nameY}\label{exa:nameZ}\label{exa:spotX}\label{exa:spotY}\label{exa:spotZ} +\begin{pspicture}(-6,-4)(6,5) + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5, + nameX=u,nameY=v,nameZ=w,spotX=90,spotY=0,spotZ=90] + \multido{\iA=0+10}{36}{\pstRotPointIIID[RotY=\iA](2,0,3){\xVal}{\yVal}{\zVal} + \pstThreeDDot[drawCoor=true](\xVal,\yVal,\zVal) + } +\end{pspicture} + +\begin{pspicture}(-6,-4)(6,5) + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] + \multido{\iA=0+10}{36}{\pstRotPointIIID[RotZ=\iA](2,0,3){\xVal}{\yVal}{\zVal} + \pstThreeDDot[drawCoor=true](\xVal,\yVal,\zVal) + } +\end{pspicture} +\end{center} + +\begin{lstlisting} +\def\xVal{}\def\yVal{}\def\zVal{} +\begin{pspicture}(-6,-4)(6,5) + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] + \multido{\iA=0+10}{36}{\pstRotPointIIID[RotX=\iA](2,0,3){\xVal}{\yVal}{\zVal} + \pstThreeDDot[drawCoor=true](\xVal,\yVal,\zVal) + } +\end{pspicture} + +\begin{pspicture}(-6,-4)(6,5) + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5, + nameX=u,nameY=v,nameZ=w,spotX=90,spotY=0,spotZ=90] + \multido{\iA=0+10}{36}{\pstRotPointIIID[RotY=\iA](2,0,3){\xVal}{\yVal}{\zVal} + \pstThreeDDot[drawCoor=true](\xVal,\yVal,\zVal) + } +\end{pspicture} + +\begin{pspicture}(-6,-4)(6,5) + \pstThreeDCoor[xMin=-1,xMax=5,yMin=-1,yMax=5,zMin=-1,zMax=5] + \multido{\iA=0+10}{36}{\pstRotPointIIID[RotZ=\iA](2,0,3){\xVal}{\yVal}{\zVal} + \pstThreeDDot[drawCoor=true](\xVal,\yVal,\zVal) + } +\end{pspicture} +\end{lstlisting} + + +\subsection{Transformation of coordinates} +To run the macros with more than 9 parameters \LPack{pst-3dplot} uses +the syntax \verb|(#1)| for a collection of three coordinates \verb|(#1,#2,#3)|. +To handle these triple in PostScript the following macro is used, which converts +the parameter \verb|#1| into a sequence of the three coordinates, dived by a space. +The syntax is: +% +\begin{BDef} +\Lcs{getThreeDCoor}\Largr{vector}\nxLcs{macro} +\end{BDef} + +\verb|\macro| holds the sequence of the three coordinates \verb|x y z|, divided by a space. + +\subsection{Adding two vectors} +The syntax is +\begin{BDef} +\Lcs{pstaddThreeDVec}\Largr{vector A}\Largr{vector B}\verb+\tempa\tempb\tempc+ +\end{BDef} + +\verb|\tempa\tempb\tempc| must be user or system defined macros, which holds the three +coordinates of the vector $\vec{C}=\vec{A}+\vec{B}$. + +\subsection{Substract two vectors} +The syntax is +\begin{BDef} +\Lcs{pstsubThreeDVec}\Largr{vector A}\Largr{vector B}\verb+\tempa\tempb\tempc+ +\end{BDef} + +\verb|\tempa\tempb\tempc| must be user or system defined macros, which holds the three +coordinates of the vector $\vec{C}=\vec{A}-\vec{B}$. + +\clearpage +\section{List of all optional arguments for \texttt{pst-3dplot}} + +\xkvview{family=pst-3dplot,columns={key,type,default}} + + +\bgroup +\nocite{*} +\RaggedRight +\printbibliography +\egroup + +\printindex + +\end{document} diff --git a/graphics/pstricks/contrib/pst-3dplot/dvips/pst-3dplot.pro b/graphics/pstricks/contrib/pst-3dplot/dvips/pst-3dplot.pro new file mode 100644 index 0000000000..fdb8e0d8d2 --- /dev/null +++ b/graphics/pstricks/contrib/pst-3dplot/dvips/pst-3dplot.pro @@ -0,0 +1,932 @@ +%% $Id: pst-3dplot.pro 401 2017-04-05 06:57:36Z herbert $ +%% +%% This is file `pst-3dplot.pro', +%% +%% IMPORTANT NOTICE: +%% +%% Package `pst-3dplot.tex' +%% +%% Herbert Voss <voss _at_ PSTricks.de> +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN archives +%% in directory macros/latex/base/lppl.txt. +%% +%% DESCRIPTION: +%% `pst-3dplot' is a PSTricks package to draw 3d curves and graphical objects +%% +%% +%% version 0.33 / 2017-04-05 Herbert Voss <hvoss _at_ tug.org> +%% with contributions of Darrell Lamm <darrell.lamm _at_ gtri.gatech.edu< +%% +% +/tx@3DPlotDict 200 dict def +tx@3DPlotDict begin +% +/printDot { gsave 2 copy 2 0 360 arc fill stroke grestore } def +% +/saveCoor { + dzUnit mul /z ED + dyUnit mul /y ED + dxUnit mul /x ED +} def +% +/3Dto2D { % true or false on stack + { RotatePoint } if + 1 { % dummy loop, will run only 1 time, allows exit + coorType 0 le { % the default | + /x2D x leftHanded not { neg } if Alpha cos mul y Alpha sin mul add def % /\ co system + /y2D x leftHanded { neg } if Alpha sin mul y Alpha cos mul add neg Beta sin mul z Beta cos mul add def + exit } if + coorType 1 le { + /x2D y x Alpha 90 sub sin mul sub def % |/_ co system, no shortened x axis + /y2D z x Alpha 90 sub cos mul sub def + exit } if + coorType 2 le { % coorType |/_ with a 1/sqrt(2) shortend x-axis and 135 degrees + /x2D y x 0.5 mul sub def + /y2D z x 0.5 mul sub def + exit } if + coorType 3 le { % coorType |/_ with a 1/sqrt(2) shortend x-axis and 135 degrees + /x2D y x -0.5 mul sub def + /y2D z x -0.5 mul sub def + exit } if + coorType 4 le { % Normalbild in Trimetrie Skalierung so, dass coorType2 + /x2D x -0.5 mul y 1 mul add def + /y2D x -0.5 mul y -0.25 mul add z 1 mul add def + exit } if + coorType 5 le { % coorType |/_ with a 1/2 shortend x-axis and 135 degrees + /x2D x z 0.5 mul Alpha cos mul add def + /y2D y z 0.5 mul Alpha sin mul add def + exit } if + coorType 6 le { % coorType |/_ with a 1/2 shortend x-axis and 135 degrees and z into the front + /x2D y x -0.559 mul Alpha cos mul add def + /y2D z x -0.559 mul Alpha sin mul add def + exit } if + coorType 7 le { % coorType |/_ with a 1/2 shortend x-axis and 135 degrees and z into the front + /x2D y x -0.5 mul Alpha cos mul add def + /y2D z x -0.5 mul Alpha sin mul add def + exit } if + } repeat +} def +/ConvertTo2D { true 3Dto2D } def +/ConvertTo2DWithoutRotating { false 3Dto2D } def +% +/Conv3D2D { /z ED /y ED /x ED ConvertTo2D x2D y2D } def +% +/ConvertToCartesian { + /latitude exch def + /longitude exch def + /Radius exch def + 1 { % dummy loop, will run only 1 time, allows exit + SphericalCoorType 0 le { % the default | + /z { Radius latitude sin mul } def + /x { Radius longitude cos mul latitude cos mul } def + /y { Radius longitude sin mul latitude cos mul } def + exit } if + SphericalCoorType 2 le { + /z { Radius longitude cos mul } def + /x { Radius longitude sin mul latitude cos mul} def + /y { Radius longitude sin mul latitude sin mul } def + exit } if + } repeat +} def +% +/ConvCylToCartesian { % r phi h -> x y z + 3 1 roll % h r phi + /Phi ED + /Radius ED % h->z on stack + Radius Phi cos mul exch % x z + Radius Phi sin mul exch % x y z +} def +% +/SphericalTo2D { + x y z ConvertToCartesian ConvertTo2D +} def +% +/CylinderTo2D { % r phi h + x y z ConvCylToCartesian ConvertTo2D +} def +% +/convertStackTo2D { + counttomark + /n ED /n3 n 3 div cvi def + n3 { + n -3 roll + SphericalCoor { ConvertToCartesian } { saveCoor } ifelse + ConvertTo2D + x2D xUnit y2D yUnit + /n n 1 sub def + } repeat +} def +% +% the angle in the parameter equation for an ellipse is not proportional to the real angle! +% phi=atan(b*tan(angle)/a)+floor(angle/180+0.5)*180 +% +/getPhi { % on stack: vecA vecB angle + 3 dict begin + /angle exch def /vecB exch def /vecA exch def + angle cvi 90 mod 0 eq { angle } { vecA angle tan mul vecB atan + angle 180 div .5 add floor 180 mul add } ifelse + end +} def +% +/RotSet (set ) def +% +/eulerRotation false def +% Matrix multiplication procedure +/matmul { + + /M@tMulDict 20 dict def + M@tMulDict begin + /m2 ED + /m1 ED + m1 dup length 2 sub 2 getinterval aload pop + /col1max ED + /row1max ED + m2 dup length 2 sub 2 getinterval aload pop + /col2max ED + /row2max ED + /m3 row1max col2max mul 2 add array def + m3 dup length 2 sub row1max col2max 2 array astore putinterval + 0 1 row1max 1 sub { + /row ED + 0 1 col2max 1 sub { + /col ED + /sum 0 def + 0 1 col1max 1 sub{ + /rowcol ED + sum + m1 row col1max mul rowcol add get + m2 rowcol col2max mul col add get + mul add + /sum ED + } for + m3 row col2max mul col add sum put + } for + } for + m3 + end % end of M@tMulDict + +} def +% +/SetMQuaternion { + + /MnewTOold 11 array def + + /Qu@ternionDict 30 dict def + Qu@ternionDict begin + + /normRotVec xRotVec yRotVec zRotVec 3 array astore VecNorm def + normRotVec 0 gt + {/xRotVecNorm xRotVec normRotVec div def + /yRotVecNorm yRotVec normRotVec div def + /zRotVecNorm zRotVec normRotVec div def + RotAngle} + {/xRotVecNorm 1 def + /yRotVecNorm 0 def + /zRotVecNorm 0 def + 0} ifelse + + 2 div dup + /q0 exch cos def + sin dup dup + /q1 exch xRotVecNorm mul def + /q2 exch yRotVecNorm mul def + /q3 exch zRotVecNorm mul def + + /q0q0 q0 q0 mul def + /q0q1 q0 q1 mul def + /q0q2 q0 q2 mul def + /q0q3 q0 q3 mul def + + /q1q1 q1 q1 mul def + /q1q2 q1 q2 mul def + /q1q3 q1 q3 mul def + + /q2q2 q2 q2 mul def + /q2q3 q2 q3 mul def + + /q3q3 q3 q3 mul def + + MnewTOold 0 q0q0 q1q1 add q2q2 sub q3q3 sub put + MnewTOold 1 q1q2 q0q3 sub 2 mul put + MnewTOold 2 q1q3 q0q2 add 2 mul put + + MnewTOold 3 q1q2 q0q3 add 2 mul put + MnewTOold 4 q0q0 q1q1 sub q2q2 add q3q3 sub put + MnewTOold 5 q2q3 q0q1 sub 2 mul put + + MnewTOold 6 q1q3 q0q2 sub 2 mul put + MnewTOold 7 q2q3 q0q1 add 2 mul put + MnewTOold 8 q0q0 q1q1 sub q2q2 sub q3q3 add put + + MnewTOold 9 3 put + MnewTOold 10 3 put + + end % end of Qu@ternionDict + +} def +% +/SetMxyz { + 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 3 3 11 array astore /MnewTOold ED + RotSequence cvx exec % Now create a new MnewTOold using xyz, etc. +} def +% +/ConcatMQuaternion { + MnewTOold % Push onto stack + SetMQuaternion % Uses [xyz]RotVec and RotAngle to make MnewToOld + MnewTOold matmul /MnewTOold ED +} def +% +/ConcatMxyz { + MnewTOold % Push onto stack + SetMxyz % Uses RotX, etc. to set MnewTOold + MnewTOold matmul /MnewTOold ED +} def +% +/RotatePoint{ + MnewTOold x y z 3 1 5 array astore matmul + 0 3 getinterval aload pop + /z ED + /y ED + /x ED +} def +% +/makeMoldTOnew { + /MoldTOnew 11 array def + MoldTOnew 0 MnewTOold 0 get put + MoldTOnew 1 MnewTOold 3 get put + MoldTOnew 2 MnewTOold 6 get put + MoldTOnew 3 MnewTOold 1 get put + MoldTOnew 4 MnewTOold 4 get put + MoldTOnew 5 MnewTOold 7 get put + MoldTOnew 6 MnewTOold 2 get put + MoldTOnew 7 MnewTOold 5 get put + MoldTOnew 8 MnewTOold 8 get put + MoldTOnew 9 3 put + MoldTOnew 10 3 put +} def +% +/RotXaxis { + eulerRotation + {1 0 0} + {makeMoldTOnew MoldTOnew 1 0 0 3 1 5 array astore matmul + 0 3 getinterval aload pop} ifelse + /zRotVec ED + /yRotVec ED + /xRotVec ED + /RotAngle RotX def + ConcatMQuaternion +} def +/RotYaxis { + eulerRotation + {0 1 0} + {makeMoldTOnew MoldTOnew 0 1 0 3 1 5 array astore matmul + 0 3 getinterval aload pop} ifelse + /zRotVec ED + /yRotVec ED + /xRotVec ED + /RotAngle RotY def + ConcatMQuaternion +} def +/RotZaxis { + eulerRotation + {0 0 1} + {makeMoldTOnew MoldTOnew 0 0 1 3 1 5 array astore matmul + 0 3 getinterval aload pop} ifelse + /zRotVec ED + /yRotVec ED + /xRotVec ED + /RotAngle RotZ def + ConcatMQuaternion +} def +/xyz { RotXaxis RotYaxis RotZaxis } def +/yxz { RotYaxis RotXaxis RotZaxis } def +/yzx { RotYaxis RotZaxis RotXaxis } def +/xzy { RotXaxis RotZaxis RotYaxis } def +/zxy { RotZaxis RotXaxis RotYaxis } def +/zyx { RotZaxis RotYaxis RotXaxis } def +/quaternion { } def % Null +% +/VecNorm { 0 exch { dup mul add } forall sqrt } def +% +/UnitVec { % on stack is [a]; returns a vector with [a][a]/|a|=1 + dup VecNorm /norm ED + norm 0 lt {/norm 0 def} if + { norm div } forall 3 array astore } def +% +/AxB { % on the stack are the two vectors [a][b] + aload pop /b3 ED /b2 ED /b1 ED + aload pop /a3 ED /a2 ED /a1 ED + a2 b3 mul a3 b2 mul sub + a3 b1 mul a1 b3 mul sub + a1 b2 mul a2 b1 mul sub + 3 array astore } def +% +/AaddB { % on the stack are the two vectors [a][b] + aload pop /b3 ED /b2 ED /b1 ED + aload pop /a3 ED /a2 ED /a1 ED + a1 b1 add a2 b2 add a3 b3 add + 3 array astore } def +% +/AmulC { % on stack is [a] and c; returns [a] mul c + /factor ED { factor mul } forall 3 array astore } def +% +% +/setColorLight { % expects 7 values on stack C M Y K xL yL zL +% les rayons de lumi�re + xLight dup mul yLight dup mul zLight dup mul add add sqrt /NormeLight ED +% the color values + /K ED + /Yellow ED + /Magenta ED + /Cyan ED +} def +% +/facetteSphere { + newpath + /Xpoint Rsphere theta cos mul phi cos mul CX add def + /Ypoint Rsphere theta sin mul phi cos mul CY add def + /Zpoint Rsphere phi sin mul CZ add def + Xpoint Ypoint Zpoint tx@3Ddict begin ProjThreeD end moveto + theta 1 theta increment add {% + /theta1 ED + /Xpoint Rsphere theta1 cos mul phi cos mul CX add def + /Ypoint Rsphere theta1 sin mul phi cos mul CY add def + /Zpoint Rsphere phi sin mul CZ add def + Xpoint Ypoint Zpoint tx@3Ddict begin ProjThreeD end lineto + } for + phi 1 phi increment add { + /phi1 ED + /Xpoint Rsphere theta increment add cos mul phi1 cos mul CX add def + /Ypoint Rsphere theta increment add sin mul phi1 cos mul CY add def + /Zpoint Rsphere phi1 sin mul CZ add def + Xpoint Ypoint Zpoint tx@3Ddict begin ProjThreeD end lineto + } for + theta increment add -1 theta {% + /theta1 ED + /Xpoint Rsphere theta1 cos mul phi increment add cos mul CX add def + /Ypoint Rsphere theta1 sin mul phi increment add cos mul CY add def + /Zpoint Rsphere phi increment add sin mul CZ add def + Xpoint Ypoint Zpoint tx@3Ddict begin ProjThreeD end lineto + } for + phi increment add -1 phi { + /phi1 ED + /Xpoint Rsphere theta cos mul phi1 cos mul CX add def + /Ypoint Rsphere theta sin mul phi1 cos mul CY add def + /Zpoint Rsphere phi1 sin mul CZ add def + Xpoint Ypoint Zpoint tx@3Ddict begin ProjThreeD end lineto + } for + closepath +} def +% +/MaillageSphere { +% on stack must be x y z Radius increment C M Y K + setColorLight + /increment ED + /Rsphere ED + /CZ ED + /CY ED + /CX ED + /StartTheta 0 def + /condition { PSfacetteSphere 0 ge } def + -90 increment 90 increment sub {% + /phi ED + StartTheta increment 360 StartTheta add increment sub {% + /theta ED + % Centre de la facette + /Xpoint Rsphere theta increment 2 div add cos mul phi increment 2 div add cos mul CX add def + /Ypoint Rsphere theta increment 2 div add sin mul phi increment 2 div add cos mul CY add def + /Zpoint Rsphere phi increment 2 div add sin mul CZ add def + % normale a la facette + /nXfacette Xpoint CX sub def + /nYfacette Ypoint CY sub def + /nZfacette Zpoint CZ sub def + % test de visibilite + /PSfacetteSphere + vX nXfacette mul + vY nYfacette mul add + vZ nZfacette mul add + def + condition { + gsave + facetteSphere + /cosV { 1 xLight nXfacette mul + yLight nYfacette mul + zLight nZfacette mul + add add + NormeLight + nXfacette dup mul + nYfacette dup mul + nZfacette dup mul + add add sqrt mul div sub } bind def + Cyan cosV mul Magenta cosV mul Yellow cosV mul K cosV mul setcmykcolor fill + grestore +% 0 setgray + showgrid { facetteSphere stroke } if + } if + } for + % /StartTheta StartTheta increment 2 div add def + } for +} def +% +%---------------------- Cylinder --------------------------- +% +/PlanCoupeCylinder { % + /TableauxPoints [ + 0 1 359 { + /phi ED + [ Radius phi Height ConvCyl2d ] % on décrit le cercle + } for + ] def + newpath + TableauxPoints 0 get aload pop moveto + 1 1 359 { TableauxPoints exch get aload pop lineto } for + closepath +} def +% +/facetteCylinder { % + newpath + Radius phi currentHeight ConvCyl2d moveto + phi 1 phi dAngle add { % loop variable on stack + Radius exch currentHeight ConvCyl2d lineto + } for + phi dAngle add -1 phi { % fill dHeight + Radius exch currentHeight dHeight add ConvCyl2d lineto + } for + closepath + } def % facette +% +/MaillageCylinder { % on stack true or false for saving values + { setColorLight % expects 4 values on stack C M Y K + /dHeight ED /dAngle ED /Height ED /Radius ED + /CZ ED /CY ED /CX ED } if +% + 0 dHeight Height dHeight sub { + /currentHeight ED + 0 dAngle 360 dAngle sub { + /phi ED +% Normal vector of the center + /nXfacetteCylinder Radius phi dAngle 2 div add cos mul CX add def + /nYfacetteCylinder Radius phi dAngle 2 div add sin mul CY add def + /nZfacetteCylinder currentHeight dHeight 2 div add CZ add def + /NormeN + nXfacetteCylinder dup mul + nYfacetteCylinder dup mul + nZfacetteCylinder dup mul + add add sqrt def + NormeN 0 eq { /NormeN 1e-10 def } if +% test de visibilité + /PSfacetteCylinder + vX nXfacetteCylinder mul + vY nYfacetteCylinder mul add + vZ nZfacetteCylinder mul add def + condition { + facetteCylinder + /cosV + 1 xLight nXfacetteCylinder mul + yLight nYfacetteCylinder mul + zLight nZfacetteCylinder mul + add add + NormeLight NormeN mul div sub def + Cyan Magenta Yellow K + cosV mul 4 1 roll cosV mul 4 1 roll + cosV dup mul mul 4 1 roll cosV dup mul mul 4 1 roll + setcmykcolor fill + showgrid { + 0 setgray + facetteCylinder % drawing the segments + stroke } if + } if + } for + } for +} def +% +%------------------------ Cylinder type II ----------------------- +% +/MoveTo { Conv3D2D moveto } def +/LineTo { Conv3D2D lineto } def + +/IIIDEllipse { % x y z rA rB startAngle endAngle Wedge + /dAngle 1 def + /isWedge ED + /endAngle ED + /startAngle ED + /radiusB ED + /radiusA ED + startAngle cos radiusA mul startAngle sin radiusB mul 0 + isWedge { 0 0 moveto LineTo }{ MoveTo } ifelse + /Angle startAngle def + startAngle dAngle endAngle { + /Angle ED + Angle cos radiusA mul Angle sin radiusB mul 0 LineTo + } for + isWedge { 0 0 lineto } if +} def + +/IIIDCircle { % x y z r startAngle endAngle Wedge + 7 3 roll % startAngle endAngle Wedge x y z r + dup % startAngle endAngle Wedge x y z r r + 8 -3 roll + IIIDEllipse +} def + +/IIIDWedge { % x y z r startAngle endAngle + true IIIDCircle +} def + +/IIIDCylinder {% x y z r h start end wedge + /isWedge ED + /increment ED + /endAngle ED + /startAngle ED + /height ED + /radius ED + startAngle increment endAngle { + /Angle ED + radius Angle 0 ConvCylToCartesian MoveTo + radius Angle height ConvCylToCartesian LineTo + } for + stroke +} def +% +%---------------------- Box --------------------------- +% +/PlanCoupeBox { % x y z + /TableauxPoints [ + [ CX CY CZ Height add ConvBox2d ] % top or bottom + [ CX CY Depth add CZ Height add ConvBox2d ] + [ CX Width add CY Depth add CZ Height add ConvBox2d ] + [ CX Width add CY CZ Height add ConvBox2d ] + [ CX CY CZ Height add ConvBox2d ] % bottom + ] def + newpath + TableauxPoints 0 get aload pop moveto + 0 1 3 { + TableauxPoints exch get aload pop + lineto } for + closepath +} def +% +/facetteBox { % + newpath + dup + 1 eq { % back + CX CY CZ ConvBox2d moveto + CX CY CZ Height add ConvBox2d lineto + CX Width add CY CZ Height add ConvBox2d lineto + CX Width add CY CZ ConvBox2d lineto + CX CY CZ ConvBox2d lineto + } if + dup + 2 eq { % right + CX CY CZ ConvBox2d moveto + CX CY CZ Height add ConvBox2d lineto + CX CY Depth add CZ Height add ConvBox2d lineto + CX CY Depth add CZ ConvBox2d lineto + CX CY CZ ConvBox2d lineto + } if + dup + 3 eq { % left + CX Width add CY CZ ConvBox2d moveto + CX Width add CY Depth add CZ ConvBox2d lineto + CX Width add CY Depth add CZ Height add ConvBox2d lineto + CX Width add CY CZ Height add ConvBox2d lineto + CX Width add CY CZ ConvBox2d lineto + } if + 4 eq { % front + CX CY Depth add CZ ConvBox2d moveto + CX CY Depth add CZ Height add ConvBox2d lineto + CX Width add CY Depth add CZ Height add ConvBox2d lineto + CX Width add CY Depth add CZ ConvBox2d lineto + CX CY Depth add CZ ConvBox2d lineto + } if + closepath + } def % facette +% +/TestPlane { % on stack x y z of the plane center and # of plane + /nZfacetteBox ED /nYfacetteBox ED /nXfacetteBox ED + /Plane ED + /NormeN + nXfacetteBox dup mul + nYfacetteBox dup mul + nZfacetteBox dup mul + add add sqrt def + NormeN 0 eq { /NormeN 1e-10 def } if +% test de visibilite + /PSfacetteBox + vX nXfacetteBox mul + vY nYfacetteBox mul add + vZ nZfacetteBox mul add def + condition { + Plane facetteBox + /cosV + 1 xLight nXfacetteBox mul + yLight nYfacetteBox mul + zLight nZfacetteBox mul + add add + NormeLight NormeN mul div sub def + Cyan Magenta Yellow K + cosV mul 4 1 roll cosV mul 4 1 roll + cosV dup mul mul 4 1 roll cosV dup mul mul 4 1 roll + setcmykcolor fill + 0 setgray + Plane facetteBox % drawing the segments + stroke + } if +} def +% +/MaillageBox { % on stack true or false for saving values + { setColorLight % expects 4 values on stack C M Y K + /Depth ED /Height ED /Width ED + /CZ ED /CY ED /CX ED } if +% +% Normal vector of the box center + /PlaneSet [ + [ Width 2 div CX add + CY + Height 2 div CZ add ] % normal back + [ CX + Depth 2 div CY add + Height 2 div CZ add ] % normal right + [ Width CX add + Depth 2 div CY add + Height 2 div CZ add ] % normal left + [ Width 2 div CX add + Depth CY add + Height 2 div CZ add ] % normal front + ] def + PlaneSequence length 0 eq { % user defined? + Alpha abs cvi 360 mod /iAlpha ED + iAlpha 90 lt { [ 1 2 3 4 ] + }{ iAlpha 180 lt { [ 2 4 1 3 ] + }{ iAlpha 270 lt { [ 3 4 1 2 ] }{ [ 3 1 4 2] } ifelse } ifelse } ifelse + }{ PlaneSequence } ifelse + { dup 1 sub PlaneSet exch get aload pop TestPlane } forall +} def +% +%--------------------------- Paraboloid ----------------------------- +/PlanCoupeParaboloid { + /Z height store + /V {Z sqrt} bind def + /TableauxPoints [ + 0 1 359 { + /U ED [ U U Z V calculate2DPoint ] % on decrit le cercle + } for + ] def + newpath + TableauxPoints 0 get aload pop moveto + 0 1 359 { + /compteur ED + TableauxPoints compteur get aload pop + lineto } for + closepath +} def +% +/facetteParaboloid{ + newpath + U U Z V calculate2DPoint moveto + U 1 U increment add {% + /U1 ED + U1 U1 Z V calculate2DPoint lineto + } for + Z pas10 Z pas add pas10 add{ + /Z1 ED + /V {Z1 sqrt} bind def + U1 U1 Z1 V calculate2DPoint lineto + } for + U increment add -1 U {% + /U2 ED + U2 U2 Z pas add V calculate2DPoint lineto + } for + Z pas add pas10 sub pas10 neg Z pas10 sub { + /Z2 ED + /V Z2 abs sqrt def + U U Z2 V calculate2DPoint lineto + } for + closepath +} def % facette +% +/MaillageParaboloid { + % on stack true or false for saving values + { setColorLight % expects 7 values on stack C M Y K xL yL zL +% /CZ ED /CY ED /CX ED + } if + 0 pas height pas sub {% + /Z ED + /V Z sqrt def + 0 increment 360 increment sub {% + /U ED +% Centre de la facette + /Ucentre U increment 2 div add def + /Vcentre Z pas 2 div add sqrt def +% normale à la facette + /nXfacetteParaboloid 2 Vcentre dup mul mul Ucentre cos mul radius mul def + /nYfacetteParaboloid 2 Vcentre dup mul mul Ucentre sin mul radius mul def + /nZfacetteParaboloid Vcentre neg radius dup mul mul def + /NormeN { + nXfacetteParaboloid dup mul + nYfacetteParaboloid dup mul + nZfacetteParaboloid dup mul + add add sqrt} bind def + NormeN 0 eq {/NormeN 1e-10 def} if +% test de visibilit� + /PSfacetteParaboloid vX nXfacetteParaboloid mul + vY nYfacetteParaboloid mul add + vZ nZfacetteParaboloid mul add def + condition { + facetteParaboloid + /cosV 1 xLight nXfacetteParaboloid mul + yLight nYfacetteParaboloid mul + zLight nZfacetteParaboloid mul + add add + NormeLight + NormeN mul div sub def + Cyan Magenta Yellow K + cosV mul 4 1 roll cosV mul 4 1 roll cosV dup mul mul 4 1 roll cosV dup mul mul 4 1 roll + setcmykcolor fill + showgrid { + 0 setgray + facetteParaboloid + stroke } if + } if + } for + } for +} def +% +% ------------------------------------ math stuff ---------------------------------- +% +% Matrix A in arrays of rows A[[row1][row2]...] +% with [row1]=[a11 a12 ... b1] +% returns on stack solution vector X=[x1 x2 ... xn] +/SolveLinEqSystem { % on stack matrix M=[A,b] (A*x=b) + 10 dict begin % hold all ocal + /A exch def + /Rows A length def % Rows = number of rows + /Cols A 0 get length def % Cols = number of columns + /Index [ 0 1 Rows 1 sub { } for ] def % Index = [0 1 2 ... Rows-1] + /col 0 def + /row 0 def + /PR Rows array def % PR[c] = pivot row for row row + { % starts the loop, find pivot entry in row r + col Cols ge row Rows ge or { exit } if % col < Cols and row < Rows else exit + /pRow row def % pRow = pivot row + /max A row get col get abs def % get A[row[col]], first A[0,0] + row 1 add 1 Rows 1 sub { % starts for loop 1 1 Rows-1 + /j exch def % index counter + /x A j get col get abs def % get A[j[r]] + x max gt { % x>max, then save position + /pRow j def + /max x def + } if + } for % now we have the row with biggest A[0,1] + % with pRow = the pivot row + max 0 gt { % swap entries pRow and row in i + /tmp Index row get def + Index row Index pRow get put + Index pRow tmp put % and columns pRow and row in A + /tmp A row get def + A row A pRow get put + A pRow tmp put % pivot + /row0 A row get def % the pivoting row + /p0 row0 col get def % the pivot value + row 1 add 1 Rows 1 sub { % start for loop + /j exch def + /c1 A j get def + /p c1 col get p0 div def + c1 col p put % subtract (p1/p0)*row[i] from row[j] + col 1 add 1 Cols 1 sub { % start for loop + /i exch def + c1 dup i exch % c1 i c1 + i get row0 i get p mul sub put + } for + } for + PR row col put + /col col 1 add def + /row row 1 add def + }{ % all zero entries + /row row 1 add def % continue loop with same row + } ifelse + } loop + /X A def % solution vector + A Rows 1 sub get dup + Cols 1 sub get exch + Cols 2 sub get div + X Rows 1 sub 3 -1 roll put % X[n] + Rows 2 sub -1 0 { % for loop to calculate X[i] + /xi exch def % current index + A xi get % i-th row + /Axi exch def + /sum 0 def + Cols 2 sub -1 xi 1 add { + /n exch def + /sum sum Axi n get X n get mul add def + } for + Axi Cols 1 sub get % b=Axi[Cols-1] + sum sub % b-sum + Axi xi get div % b-sum / Axi[xi] + X xi 3 -1 roll put % X[xi] + } for + X + end +} def +% +% u -> e_u with |e_u|=1 +/vector-unit { 1 dict begin + dup vector-length 1 exch div + vector-scale + end +} def +% +% u v -> u+v +/vector-add { 1 dict begin + /v exch def + [ exch + 0 % u i + exch { % i u[i] + v % i u[i] v + 2 index get add % i u[i]+v[i] + exch 1 add % i + } forall + pop + ] + end +} def +% +% u v -> u-v +/vector-sub { 1 dict begin + /v exch def + [ exch + 0 % u i + exch { % i u[i] + v % i u[i] v + 2 index get sub % i u[i]+v[i] + exch 1 add % i + } forall + pop + ] +end } def +% +% [v] c -> [c.v] +/vector-scale { 1 dict begin + /c exch def + [ exch + { % s i u[i] + c mul % s i u[i] v + } forall + ] + end } def +% +% +% [u] [v] -> [u x v] +/vector-prod { %% x1 y1 z1 x2 y2 z2 +6 dict begin + aload pop + /zp exch def /yp exch def /xp exch def + aload pop + /z exch def /y exch def /x exch def + [ y zp mul z yp mul sub + z xp mul x zp mul sub + x yp mul y xp mul sub ] +end +} def +% +% [u] [v] -> u.v +/vector-mul { %% x1 y1 z1 x2 y2 z2 +6 dict begin + aload pop + /zp exch def /yp exch def /xp exch def + aload pop + /z exch def /y exch def /x exch def + x xp mul y yp mul add z zp mul add +end +} def +% +% [x y z ... ] -> r +% watch out for overflow +/vector-length { 1 dict begin +dup +% find maximum entry +/max 0 def +{ % max + abs dup max gt { + % if abs gt max + /max exch def + } { + pop + } ifelse +} forall +max 0 ne { + 0 exch + { % 0 v[i] + max div dup mul add + } forall + sqrt + max mul +} { + pop 0 +} ifelse +end } def +% +end % tx@3DPlotDict +%
\ No newline at end of file diff --git a/graphics/pstricks/contrib/pst-3dplot/latex/pst-3dplot.sty b/graphics/pstricks/contrib/pst-3dplot/latex/pst-3dplot.sty new file mode 100644 index 0000000000..30173c1270 --- /dev/null +++ b/graphics/pstricks/contrib/pst-3dplot/latex/pst-3dplot.sty @@ -0,0 +1,17 @@ +%% $Id: pst-3dplot.sty 401 2017-04-05 06:57:36Z herbert $ +\RequirePackage{pstricks} +\RequirePackage{pst-3d} +\RequirePackage{pst-plot} +\RequirePackage{pst-node} +\RequirePackage{multido} +\ProvidesPackage{pst-3dplot}[2010/01/01 package wrapper for + pst-3dplot.tex (hv)] +\input{pst-3dplot.tex} +\IfFileExists{pst-3dplot.pro}{% + \ProvidesFile{pst-3dplot.pro} + [2017/04/05 v. 0.33, PostScript prologue file (hv)] + \@addtofilelist{pst-3dplot.pro}}{}% +\ProvidesFile{pst-3dplot.tex} + [\filedate\space v\fileversion\space `PST-3dplot' (hv)] +\endinput + diff --git a/graphics/pstricks/contrib/pst-3dplot/tex/pst-3dplot.tex b/graphics/pstricks/contrib/pst-3dplot/tex/pst-3dplot.tex new file mode 100644 index 0000000000..38c21da9c3 --- /dev/null +++ b/graphics/pstricks/contrib/pst-3dplot/tex/pst-3dplot.tex @@ -0,0 +1,2562 @@ +%% $Id: pst-3dplot.tex 401 2017-04-05 06:57:36Z herbert $ +%% +%% This is file `pst-3dplot.tex', +%% +%% IMPORTANT NOTICE: +%% +%% Package `pst-3dplot.tex' +%% +%% Herbert Voss <hvoss _at_ tug.org> +%% with contributions of Darrell Lamm <darrell.lamm _at_ gtri.gatech.edu< +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN archives +%% in directory macros/latex/base/lppl.txt. +%% +%% DESCRIPTION: +%% `pst-3dplot' is a PSTricks package to draw 3d curves, +%% data and different graphical objects +%% +\csname PSTThreeDplotLoaded\endcsname +\let\PSTThreeDplotLoaded\endinput +% Requires PSTricks, pst-node, pst-plot, multido packages +\ifx\PSTricksLoaded\endinput\else \input pstricks.tex\fi +\ifx\PSTnodesLoaded\endinput\else \input pst-3d.tex\fi +\ifx\PSTplotLoaded\endinput\else \input pst-plot.tex\fi +\ifx\PSTnodeLoaded\endinput\else \input pst-node.tex\fi +\ifx\PSTMultidoLoaded\endinput\else \input multido.tex\fi +\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi +% +\def\fileversion{2.04} +\def\filedate{2017/04/05} +\message{`PST-3dplot' v\fileversion, \filedate\space (HV,DL)} +% +\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax + +\pst@addfams{pst-3dplot} +\SpecialCoor + +\newdimen\pst@dimf +% +\define@boolkey[psset]{pst-3dplot}[Pst@]{Debug}[true]{}% +\define@boolkey[psset]{pst-3dplot}[Pst@]{alternative}[true]{}% for switches +\define@boolkey[psset]{pst-3dplot}[Pst@]{drawing}[true]{}% draw the coordinates? +\define@boolkey[psset]{pst-3dplot}[Pst@]{drawCoor}[true]{}% draw the coordinates of a dot? +\define@boolkey[psset]{pst-3dplot}[Pst@]{hiddenLine}[true]{}% emulate hidden line surface? +\define@boolkey[psset]{pst-3dplot}[Pst@]{SphericalCoor}[true]{}% (r,phi,theta) +\define@boolkey[psset]{pst-3dplot}[Pst@]{IIIDshowgrid}[true]{}% draw the coordinates of a dot? +\define@boolkey[psset]{pst-3dplot}[Pst@]{CoorCheck}[true]{}% check the coordinates +\define@boolkey[psset]{pst-3dplot}[Pst@]{CylindricalCoor}[true]{}% (r,phi,z) +\define@boolkey[psset]{pst-3dplot}[Pst@]{leftHanded}[true]{}% left-Handed coor +\define@boolkey[psset]{pst-3dplot}[Pst@]{eulerRotation}[true]{}% Use Euler rotation definition +\define@key[psset]{pst-3dplot}{coorType}[0]{% + \pst@getint{#1}\psk@ThreeDplot@coorType + \ifcase\psk@ThreeDplot@coorType + % 0 is the default + \or +% \def\psk@ThreeDplot@Beta{0} + \or %2 + \def\psk@ThreeDplot@Alpha{135} +% \def\psk@ThreeDplot@Beta{0} + \or %3 + \def\psk@ThreeDplot@Alpha{45} + \or %4 +% \def\psk@ThreeDplot@Alpha{135} + \or %5 + \or %6 + \def\psk@ThreeDplot@Alpha{26.565} + \or %7 + \def\psk@ThreeDplot@Alpha{26.565} + \else + \fi} +% 0 default +% 1 z y are orthogonal and angle x|y is Alpha, Beta has no meaning +% 1 z y are orthogonal and angle Alpha is always 135, x-axis shortened by 1/sqrt(2), Beta has no meaning +\define@key[psset]{pst-3dplot}{SphericalCoorType}[0]{\pst@getint{#1}{\psk@ThreeDplot@SphericalCoorType}} +\psset[pst-3dplot]{drawing,drawCoor,hiddenLine=false,SphericalCoor=false,SphericalCoorType=0, + leftHanded=false,eulerRotation=false,coorType=0} +% +% ------- the global definitions for the pspicture frame ------ +% +\define@key[psset]{pst-3dplot}{xMin}[-1]{\def\psk@ThreeDplot@xMin{#1}} +\define@key[psset]{pst-3dplot}{xMax}[4]{\def\psk@ThreeDplot@xMax{#1}} +\define@key[psset]{pst-3dplot}{yMin}[-1]{\def\psk@ThreeDplot@yMin{#1}} +\define@key[psset]{pst-3dplot}{yMax}[4]{\def\psk@ThreeDplot@yMax{#1}} +\define@key[psset]{pst-3dplot}{zMin}[-1]{\def\psk@ThreeDplot@zMin{#1}} +\define@key[psset]{pst-3dplot}{zMax}[4]{\def\psk@ThreeDplot@zMax{#1}} +\define@key[psset]{pst-3dplot}{xThreeDunit}[1.0]{\def\psk@ThreeDplot@xThreeDunit{#1}} +%\define@key[psset]{pst-3dplot}{xThreeDunit}{\pst@checknum{#1}\psk@ThreeDplot@xThreeDunit } +\define@key[psset]{pst-3dplot}{yThreeDunit}[1.0]{\def\psk@ThreeDplot@yThreeDunit{#1}} +\define@key[psset]{pst-3dplot}{zThreeDunit}[1.0]{\def\psk@ThreeDplot@zThreeDunit{#1}} +\define@key[psset]{pst-3dplot}{xRotVec}[0]{\pst@checknum{#1}\psk@ThreeDplot@xRotVec } % Rotation vector x +\define@key[psset]{pst-3dplot}{yRotVec}[0]{\pst@checknum{#1}\psk@ThreeDplot@yRotVec } % Rotation vector y +\define@key[psset]{pst-3dplot}{zRotVec}[0]{\pst@checknum{#1}\psk@ThreeDplot@zRotVec } % Rotation vector z +\define@key[psset]{pst-3dplot}{deltax}[1.0]{\def\psk@ThreeDplot@deltax{#1}} +%\define@key[psset]{pst-3dplot}{deltax}{\pst@checknum{#1}\psk@ThreeDplot@deltax} +\define@key[psset]{pst-3dplot}{deltay}[1.0]{\def\psk@ThreeDplot@deltay{#1}} +\define@key[psset]{pst-3dplot}{deltaz}[1.0]{\def\psk@ThreeDplot@deltaz{#1}} +\define@key[psset]{pst-3dplot}{Deltax}[1.0]{\def\psk@ThreeDplot@Deltax{#1}} +\define@key[psset]{pst-3dplot}{Deltay}[1.0]{\def\psk@ThreeDplot@Deltay{#1}} +\define@key[psset]{pst-3dplot}{Deltaz}[1.0]{\def\psk@ThreeDplot@Deltaz{#1}} +% +% -------------- the angles and the plotpoints ------------- +% +\define@key[psset]{pst-3dplot}{Alpha}[45]{\pst@getangle{#1}\psk@ThreeDplot@Alpha } % Horizontal turn +\define@key[psset]{pst-3dplot}{Beta}[30]{\pst@getangle{#1}\psk@ThreeDplot@Beta }% Vertical turn +\define@key[psset]{pst-3dplot}{RotX}[0]{\pst@getangle{#1}\psk@ThreeD@RotX }% x rotation +\define@key[psset]{pst-3dplot}{RotY}[0]{\pst@getangle{#1}\psk@ThreeD@RotY }% y rotation +\define@key[psset]{pst-3dplot}{RotZ}[0]{\pst@getangle{#1}\psk@ThreeD@RotZ }% z rotation +\define@key[psset]{pst-3dplot}{RotAngle}[0]{\pst@getangle{#1}\psk@ThreeD@RotAngle }% General rotation angle +\define@key[psset]{pst-3dplot}{RotSequence}[xyz]{\def\psk@ThreeD@RotS{#1 }}% +% Set or Concat +\define@key[psset]{pst-3dplot}{RotSet}[set]{\def\psk@ThreeD@RotSet{#1 }}% +\define@key[psset]{pst-3dplot}{PlaneSequence}[{}]{\def\psk@ThreeD@PlaneSequence{#1 }}% +\define@key[psset]{pst-3dplot}{zCoor}[0]{\pst@checknum{#1}\psk@ThreeDplot@zCoor } +\psset[pst-3dplot]{zCoor=0} +% +\def\drawStyle@xLines{xLines}% 0 +\def\drawStyle@yLines{yLines}% 1 +\def\drawStyle@xyLines{xyLines}% 2 +\def\drawStyle@yxLines{yxLines}% 3 +\define@key[psset]{pst-3dplot}{drawStyle}[xLines]{% how to draw 3D functions + \def\pst@tempA{#1}% + \ifx\pst@tempA\drawStyle@xLines\let\psk@ThreeDplot@drawStyle\z@\else% + \ifx\pst@tempA\drawStyle@yLines\let\psk@ThreeDplot@drawStyle\@ne\else% + \ifx\pst@tempA\drawStyle@xyLines\let\psk@ThreeDplot@drawStyle\tw@\else% + \ifx\pst@tempA\drawStyle@yxLines\let\psk@ThreeDplot@drawStyle\thr@@\else% + \@pstrickserr{Bad draw style: `\pst@tempa'}\@ehpa% + \fi\fi\fi\fi% +% \typeout{drawStyle: \the\psk@ThreeDplot@drawStyle} + } +\psset[pst-3dplot]{drawStyle=xLines} +% +\define@key[psset]{pst-3dplot}{xPlotpoints}[25]{\def\psk@ThreeDplot@xPlotpoints{#1}} +\define@key[psset]{pst-3dplot}{yPlotpoints}[25]{\def\psk@ThreeDplot@yPlotpoints{#1}} +\define@key[psset]{pst-3dplot}{beginAngle}[0]{\def\psk@ThreeDplot@beginAngle{#1}}% for ellipse/circle arc +\define@key[psset]{pst-3dplot}{endAngle}[360]{\def\psk@ThreeDplot@endAngle{#1}}% for ellipse/circle arc +%\define@key[psset]{pst-3dplot}{linejoin}{\def\psk@ThreeDplot@linejoin{#1 }}% how lines come together 0,1,2 +\define@key[psset]{pst-3dplot}{plane}[xy]{\def\psk@ThreeDplot@plane{#1}}% xy,xz,yz +% must be expanded +\define@key[psset]{pst-3dplot}{pOrigin}[c]{\def\psk@ThreeDplot@pOrigin{#1}}% combination of (lr)(tBb) +\define@key[psset]{pst-3dplot}{IIIDdAlpha}[0]{\def\psk@IIIDdAlpha{#1 }} +\def\ThreeDplot@planeXY{xy} +\def\ThreeDplot@planeXZ{xz} +\def\ThreeDplot@planeYZ{yz} +% +% -------------- the length and node definitions ------------- +% +\iffalse +\define@key[psset]{pst-3dplot}{XO}[0]{\def\psk@ThreeDplot@XO{#1}}% the X-offset +\define@key[psset]{pst-3dplot}{YO}[0]{\def\psk@ThreeDplot@YO{#1}}% the y-offset +\define@key[psset]{pst-3dplot}{posStart}[0]{\def\psk@ThreeDplot@posStart{#1}}% where the arrows start +\define@key[psset]{pst-3dplot}{length}[2]{\def\psk@ThreeDplot@length{#1}}% the length of the before|outlines +\define@key[psset]{pst-3dplot}{arrowOffset}[0]{\def\psk@ThreeDplot@arrowOffset{#1}}%offset for \arrowLine +\fi + +\define@key[psset]{pst-3dplot}{visibleLineStyle}[solid]{\def\psk@ThreeDplot@visibleLineStyle{#1}}% +\define@key[psset]{pst-3dplot}{invisibleLineStyle}[dashed]{\def\psk@ThreeDplot@invisibleLineStyle{#1}} +% +\define@boolkey[psset]{pst-3dplot}[Pst@]{IIIDticks}[true]{} +\define@boolkey[psset]{pst-3dplot}[Pst@]{IIIDlabels}[true]{} +\define@key[psset]{pst-3dplot}{Dz}[1]{\def\psk@Dz{#1}} +\define@key[psset]{pst-3dplot}{IIIDxTicksPlane}[xy]{\def\psk@IIIDxTicksPlane{#1}} +\define@key[psset]{pst-3dplot}{IIIDyTicksPlane}[yz]{\def\psk@IIIDyTicksPlane{#1}} +\define@key[psset]{pst-3dplot}{IIIDzTicksPlane}[yz]{\def\psk@IIIDzTicksPlane{#1}} +\define@key[psset]{pst-3dplot}{IIIDticksize}[0.1]{\def\psk@IIIDticksize{#1}} +\define@key[psset]{pst-3dplot}{IIIDxticksep}[-0.2]{\def\psk@IIIDxticksep{#1}} +\define@key[psset]{pst-3dplot}{IIIDyticksep}[-0.2]{\def\psk@IIIDyticksep{#1}} +\define@key[psset]{pst-3dplot}{IIIDzticksep}[0.2]{\def\psk@IIIDzticksep{#1}} +\define@key[psset]{pst-3dplot}{nameX}[$x$]{\def\psk@ThreeDplot@nameX{#1}}% start of the object arrow +\define@key[psset]{pst-3dplot}{spotX}[180]{\def\psk@ThreeDplot@spotX{#1}}% where to draw the label +\define@key[psset]{pst-3dplot}{nameY}[$y$]{\def\psk@ThreeDplot@nameY{#1}} +\define@key[psset]{pst-3dplot}{spotY}[0]{\def\psk@ThreeDplot@spotY{#1}} +\define@key[psset]{pst-3dplot}{nameZ}[$z$]{\def\psk@ThreeDplot@nameZ{#1}} +\define@key[psset]{pst-3dplot}{spotZ}[90]{\def\psk@ThreeDplot@spotZ{#1}} +% +% ### begin Torsten Suhling +\define@key[psset]{pst-3dplot}{planecorr}[none]{\def\psk@ThreeDplot@planecorr{#1}}% make plane tags readable +\def\ThreeDplot@planecorrNone{none} % default +\def\ThreeDplot@planecorrNormal{normal} % make planes readable +\def\ThreeDplot@planecorrXYrot{xyrot} % and put tag for xy-plane +% % parallel to the y-axis +% ### end Torsten Suhling +% +\def\psds@none{\pst@gdot{}}% define none for the dotstyle +% +\newpsstyle{showCoorStyle}{linestyle=dashed,linecolor=black,linewidth=0.5pt} +\newpsstyle{hiddenStyle}{fillstyle=solid,fillcolor=white} +\newcount\pst@cntx \newcount\pst@cnty \newcount\pst@cntz +\newdimen\pst@dimx \newdimen\pst@dimy \newdimen\pst@dimz +% +\define@key[psset]{pst-3dplot}{planeGrid}[xy]{\def\psk@planeGrid{#1}} +\define@key[psset]{pst-3dplot}{planeGridOffset}[0]{\def\psk@planeGridOffset{#1}} +% +\define@boolkey[psset]{pst-3dplot}[PstThreeDplot@]{showInside}[true]{} +\define@key[psset]{pst-3dplot}{SegmentColor}{\pst@getcolor{#1}\psk@ThreeDplot@SegmentColor} +\define@key[psset]{pst-3dplot}{increment}[10]{\pst@checknum{#1}\psk@ThreeDplot@increment} +\define@key[psset]{pst-3dplot}{Hincrement}[0.5]{\pst@checknum{#1}\psk@ThreeDplot@Hincrement} +\define@key[psset]{pst-3dplot}{xyzLight}[1 1 2]{\def\psk@ThreeDplot@xyzLight{#1 }} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% B A S I C S % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\pstheader{pst-3dplot.pro} +% ---- only shortcuts ------- +\def\pst@3ddict{tx@3DPlotDict begin } +\def\tx@3DPlotDict{tx@3DPlotDict begin } +\def\tx@saveCoor{\pst@3ddict saveCoor end } +\def\tx@X{\pst@3ddict x end } +\def\tx@Y{\pst@3ddict y end } +\def\tx@Z{\pst@3ddict z end } +\def\tx@xIID{\pst@3ddict x2D end } +\def\tx@yIID{\pst@3ddict y2D end } +\def\tx@ConvertToIID{\pst@3ddict ConvertTo2D end } +\def\tx@SphericalCoor{\pst@3ddict SphericalCoor end } +\def\tx@ConvertToCartesian{\pst@3ddict ConvertToCartesian end } +\def\tx@ConvCylToCartesian{\pst@3ddict ConvCylToCartesian end } +% +% +\def\setIIIDplotDefaults{% + \psset[pstricks]{linejoin=1}% + \psset[pst-3dplot]{ + Debug=false,CoorCheck=true,alternative=false, + drawing=true,hiddenLine=false,eulerRotation=false, + xMin=-1,xMax=4,yMin=-1,yMax=4,zMin=-1,zMax=4, + xThreeDunit=1,yThreeDunit=1.0,zThreeDunit=1.0,Alpha=45,Beta=30, + deltax=1,deltay=1.0,deltaz=1.0,Deltax=1.0,Deltay=1.0,Deltaz=1.0, + RotX=0,RotY=0,RotZ=0,RotSequence=xyz,RotSet=set, + xRotVec=1,yRotVec=0,zRotVec=0,RotAngle=0, + PlaneSequence={}, + drawStyle=xLines,xPlotpoints=25,yPlotpoints=25,beginAngle=0,endAngle=360, +% XO=0,YO=0,posStart=0,length=2,arrowOffset=0, + visibleLineStyle=solid,invisibleLineStyle=dashed,nameX=$x$,spotX=180, + nameY=$y$,spotY=0,nameZ=$z$,spotZ=90,plane=xy,pOrigin=c, + drawCoor=false,SphericalCoor=false, CylindricalCoor=false, + Dz=1,IIIDticks=false,IIIDlabels=false,IIIDxTicksPlane=xy,IIIDyTicksPlane=yz,IIIDzTicksPlane=yz, + IIIDticksize=0.1,IIIDxticksep=-0.4,IIIDyticksep=-0.2,IIIDzticksep=0.2, + planecorr=none, + planeGrid=xy,planeGridOffset=0,%subticks=10, + leftHanded=false,coorType=0,IIIDdAlpha=0, + xyzLight=1 1 2,showInside=true,SegmentColor={[cmyk]{0.2,0.6,1,0}}, + increment=10,Hincrement=0.5, + IIIDshowgrid, + }% + \def\pst@linetype{2}% to prevent an unknown linetyp with dash +} +\setIIIDplotDefaults +% +\def\IIIDplot@variables{ + /RotX \psk@ThreeD@RotX\space def + /RotY \psk@ThreeD@RotY\space def + /RotZ \psk@ThreeD@RotZ\space def + /RotAngle \psk@ThreeD@RotAngle\space def + /xRotVec \psk@ThreeDplot@xRotVec\space def + /yRotVec \psk@ThreeDplot@yRotVec\space def + /zRotVec \psk@ThreeDplot@zRotVec\space def + /dxUnit \psk@ThreeDplot@xThreeDunit\space def + /dyUnit \psk@ThreeDplot@yThreeDunit\space def + /dzUnit \psk@ThreeDplot@zThreeDunit\space def + /RotSequence (\psk@ThreeD@RotS) def + /RotSet (\psk@ThreeD@RotSet) def + /Alpha \psk@ThreeDplot@Alpha\space def + /Beta \psk@ThreeDplot@Beta\space def + /Sin1 Beta sin def + /Sin2 Alpha sin def + /Cos1 Beta cos def + /Cos2 Alpha cos def + /Cos1Sin2 Cos1 Sin2 mul def + /Sin1Sin2 Sin1 Sin2 mul def + /Cos1Cos2 Cos1 Cos2 mul def + /Sin1Cos2 Sin1 Cos2 mul def + /showgrid \ifPst@IIIDshowgrid true \else false \fi def + currentdict tx@3DPlotDict ne dup + {tx@3DPlotDict begin} if % Begin the correct dict if necessary + /eulerRotation \ifPst@eulerRotation true \else false \fi def + RotSet (set ) eq currentdict /MnewTOold known not or + {/PROCMXYZ /SetMxyz def /PROCMQUATERNION /SetMQuaternion def} + {RotSet (concat ) eq + {/PROCMXYZ /ConcatMxyz def /PROCMQUATERNION /ConcatMQuaternion def} + {/PROCMXYZ () def /PROCMQUATERNION () def} ifelse + } ifelse + RotSequence (quaternion ) ne {PROCMXYZ} {PROCMQUATERNION} ifelse cvx exec + /RotSet (keep ) def + {end} if % End the correct dict if necessary + /leftHanded \ifPst@leftHanded true \else false \fi def + /coorType \psk@ThreeDplot@coorType\space def + /SphericalCoorType \psk@ThreeDplot@SphericalCoorType\space def + \psk@ThreeDplot@xyzLight\space + /zLight ED /yLight ED /xLight ED +}% +% +% (#1) -> #1 #2 #3 +\def\getThreeDCoor#1#2{\pst@getThreeDcoor(#1)\let#2\pst@coorIIID} +\def\pst@getThreeDcoor(#1,#2,#3){% + \edef\pst@coorIIID{#1\space #2\space #3\space}% +} +\def\pst@addThreeDVec(#1)(#2)#3#4#5{% (#1)+(#2)=(#3,#4,#5) + \pst@calcThreeDVec(#1)(#2)% + \let#3\pst@getValueX% + \let#4\pst@getValueY% + \let#5\pst@getValueZ% +} +\def\pst@addThreeDVecPS(#1,#2,#3)(#4,#5,#6)#7#8#9{% (#1)+(#2)=(#7,#8,#9) + \def#7{ #1 #4 add }% + \def#8{ #2 #5 add }% + \def#9{ #3 #6 add }% +} +\def\pst@subThreeDVec(#1)(#2,#3,#4)#5#6#7{% (#1)-(#2,#3,#4)=(#5,#6,#7) + \pst@calcThreeDVec(#1)(-#2,-#3,-#4)% + \let#5\pst@getValueX% + \let#6\pst@getValueY% + \let#7\pst@getValueZ% +} +\def\pst@subThreeDVecPS(#1,#2,#3)(#4,#5,#6)#7#8#9{% (#1)-(#2)=(#7,#8,#9) + \def#7{ #1 #4 sub }% + \def#8{ #2 #5 sub }% + \def#9{ #3 #6 sub }% +} +% +\def\pst@calcThreeDVec(#1,#2,#3)(#4,#5,#6){{% #1+#4; #2+#5; #3+#6 + \pst@dima=#1 pt% + \pst@dimb=#2 pt% + \pst@dimc=#3 pt% + \pst@dimf=#4 pt% + \pst@dimg=#5 pt% + \pst@dimh=#6 pt% + \advance\pst@dima by \pst@dimf% + \advance\pst@dimb by \pst@dimg% + \advance\pst@dimc by \pst@dimh% + \xdef\pst@getValueX{\pst@number\pst@dima}% + \xdef\pst@getValueY{\pst@number\pst@dimb}% + \xdef\pst@getValueZ{\pst@number\pst@dimc}% +}}% +% +% the ThreeD coordinate system +% +\def\psxyzlabel#1{\bgroup\footnotesize\textsf{#1}\egroup} +% +\define@key[psset]{pst-3dplot}{IIIDOffset}%[{(0,0,0)}] + {\def\psk@ThreeDplot@Offset{#1}} +\define@key[psset]{pst-3dplot}{zlabelFactor}[\relax]{\def\psk@zlabelFactor{#1}} +\psset[pst-3dplot]{IIIDOffset={(0,0,0)},zlabelFactor={}}% for coor axes +% +\def\pst@getIIIDValues(#1,#2,#3)#4#5#6\@nil{\def#4{#1}\def#5{#2}\def#6{#3}} +% +\def\pstThreeDCoor{\def\pst@par{}\pst@object{pstThreeDCoor}} +\def\pstThreeDCoor@i{% + \pst@killglue% + \begingroup% + \addbefore@par{linewidth=0.5pt,linecolor=red,arrows=->,dotstyle=|}% + \use@par% + \expandafter\pst@getIIIDValues\psk@ThreeDplot@Offset{\pst@OffsetX}{\pst@OffsetY}{\pst@OffsetZ}\@nil + \pstThreeDNode(\psk@ThreeDplot@xMin,\pst@OffsetY,\pst@OffsetZ){xMin}% + \psset[pst-3dplot]{RotSet=keep}% Keep the current rotation matrix + \pstThreeDNode(\psk@ThreeDplot@xMax,\pst@OffsetY,\pst@OffsetZ){xMax}% + \pstThreeDNode(\pst@OffsetX,\psk@ThreeDplot@yMin,\pst@OffsetZ){yMin}% + \pstThreeDNode(\pst@OffsetX,\psk@ThreeDplot@yMax,\pst@OffsetZ){yMax}% + \pstThreeDNode(\pst@OffsetX,\pst@OffsetY,\psk@ThreeDplot@zMin){zMin}% + \pstThreeDNode(\pst@OffsetX,\pst@OffsetY,\psk@ThreeDplot@zMax){zMax}% + \ifPst@drawing% ThreeDplot axes + \psline(xMin)(xMax)% + \psline(yMin)(yMax)% + \psline(zMin)(zMax)% + \uput[\psk@ThreeDplot@spotX](xMax){\psk@ThreeDplot@nameX}% + \uput[\psk@ThreeDplot@spotY](yMax){\psk@ThreeDplot@nameY}% + \uput[\psk@ThreeDplot@spotZ](zMax){\psk@ThreeDplot@nameZ}% + \ifPst@IIIDticks% +%------------ x ticks and labels -------------------------- + \ifdim\psk@ThreeDplot@xMax pt>0pt % only for positive parts of the axes + \ifdim\psk@ThreeDplot@xMin pt>\z@ + \pstFPadd\pst@tempC\psk@ThreeDplot@xMax{-\psk@ThreeDplot@xMin} + \else\let\pst@tempC\psk@ThreeDplot@xMax\fi + \pstFPadd\pst@tempC\pst@tempC{-\pst@OffsetX} + \pstFPDiv\pst@tempB\pst@tempC{\psk@ThreeDplot@deltax} + \pst@cntx=\pst@tempB \advance\pst@cntx by -1% + \pstFPdiv\pst@tempB\psk@IIIDticksize{\psk@ThreeDplot@yThreeDunit} + \pstFPadd\pst@tempA{-\pst@tempB}{\pst@OffsetY} + \pstFPadd\pst@tempB{\pst@tempB}{\pst@OffsetY} + \pstFPadd\pst@tempC\pst@OffsetX{\psk@ThreeDplot@deltax} + \pstFPadd\pst@tempD\pst@OffsetX{\psk@Dx} + \pst@dimm=\pst@tempD pt\edef\pst@tempD{\strip@pt\pst@dimm}% strip the 00... from fp + \pstFPadd\pst@tempE{\psk@IIIDxticksep}{\pst@OffsetY} + \pstFPdiv\pst@tempE\pst@tempE\psk@ThreeDplot@yThreeDunit + \edef\@xyDecimals{\psk@xDecimals}% + \multido{\nA=\pst@tempD+\psk@Dx, + \rB=\pst@tempC+\psk@ThreeDplot@deltax} + {\the\pst@cntx}{% + \ifx\psk@IIIDxTicksPlane\ThreeDplot@planeXY + \pstThreeDLine[arrows=-](\rB,\pst@tempA,\pst@OffsetZ)(\rB,\pst@tempB,\pst@OffsetZ)% + \else + \ifx\psk@IIIDxTicksPlane\ThreeDplot@planeXZ + \pstThreeDLine[arrows=-](\rB,\pst@OffsetZ,\pst@tempA)(\rB,\pst@OffsetZ,\pst@tempB)% + \fi\fi + \ifPst@IIIDlabels% + \pstPlanePut[plane=\psk@IIIDxTicksPlane](\rB,\pst@tempE,\pst@OffsetZ){% + \psxyzlabel{\expandafter\@LabelComma\nA..\@nil\psk@xlabelFactor}}% +% \psxyzlabel{\nA\psk@xlabelFactor}}% + \fi% + }% end of multido + \fi% + \ifdim\psk@ThreeDplot@xMin pt<\z@\relax % only for negative parts of the axes + \pstFPadd\pst@tempB\psk@ThreeDplot@xMin{-\pst@OffsetX} + \pstFPDiv\pst@tempB\pst@tempB{\psk@ThreeDplot@deltax}% + \pst@cntx=-\pst@int{\pst@tempB}% + \pstFPdiv{\pst@tempB}{\psk@IIIDticksize}{\psk@ThreeDplot@yThreeDunit} + \pstFPadd{\pst@tempA}{-\pst@tempB}{\pst@OffsetY} + \pstFPadd{\pst@tempB}{\pst@tempB}{\pst@OffsetY} + \pstFPadd{\pst@tempC}{\pst@OffsetX}{-\psk@ThreeDplot@deltax} + \pstFPadd{\pst@tempD}{\pst@OffsetX}{-\psk@Dx} + \pst@dimm=\pst@tempD pt\edef\pst@tempD{\strip@pt\pst@dimm}% strip the 00... from fp + \pstFPadd\pst@tempE{\psk@IIIDxticksep}{\pst@OffsetY} + \pstFPdiv\pst@tempE\pst@tempE\psk@ThreeDplot@yThreeDunit + \edef\@xyDecimals{\psk@xDecimals}% + \multido{\nA=\pst@tempD+-\psk@Dx, + \rB=\pst@tempC+-\psk@ThreeDplot@deltax} + {\the\pst@cntx}{% + \ifx\psk@IIIDxTicksPlane\ThreeDplot@planeXY + \pstThreeDLine[arrows=-](\rB,\pst@tempA,\pst@OffsetZ)(\rB,\pst@tempB,\pst@OffsetZ)% + \else + \ifx\psk@IIIDxTicksPlane\ThreeDplot@planeXZ + \pstThreeDLine[arrows=-](\rB,\pst@OffsetY,\pst@tempA)(\rB,\pst@OffsetZ,\pst@tempB)% + \fi\fi + \ifPst@IIIDlabels% + \pstPlanePut[plane=\psk@IIIDxTicksPlane](\rB,\pst@tempE,\pst@OffsetZ){% + \psxyzlabel{\expandafter\@LabelComma\nA..\@nil\psk@xlabelFactor}}% +% \psxyzlabel{\nA\psk@xlabelFactor}}% + \fi% + }% end of multido and the x ticks and labels + \fi +%------------ y ticks and labels -------------------------- + \ifdim\psk@ThreeDplot@yMax pt>0pt % only for positive parts of the axes + \ifdim\psk@ThreeDplot@yMin pt>\z@ + \pstFPadd\pst@tempC\psk@ThreeDplot@yMax{-\psk@ThreeDplot@yMin} + \else\let\pst@tempC\psk@ThreeDplot@yMax\fi + \pstFPadd\pst@tempC\pst@tempC{-\pst@OffsetY} + \pstFPDiv\pst@tempB\pst@tempC{\psk@ThreeDplot@deltay} + \pst@cnty=\pst@tempB \advance\pst@cnty by -1% + \pstFPdiv\pst@tempB\psk@IIIDticksize{\psk@ThreeDplot@xThreeDunit} + \pstFPadd\pst@tempA{-\pst@tempB}{\pst@OffsetX} + \pstFPadd\pst@tempB{\pst@tempB}{\pst@OffsetX} + \pstFPadd\pst@tempC{\pst@OffsetY}{\psk@ThreeDplot@deltay} + \pstFPadd\pst@tempD{\pst@OffsetY}{\psk@Dy} + \pst@dimm=\pst@tempD pt\edef\pst@tempD{\strip@pt\pst@dimm}% strip the 00... from fp + \pstFPadd\pst@tempE{\psk@IIIDyticksep}{\pst@OffsetX} + \pstFPdiv\pst@tempE\pst@tempE\psk@ThreeDplot@xThreeDunit + \edef\@xyDecimals{\psk@xDecimals}% + \multido{\nA=\pst@tempD+\psk@Dy, + \rB=\pst@tempC+\psk@ThreeDplot@deltay} + {\the\pst@cnty}{% + \ifx\psk@IIIDyTicksPlane\ThreeDplot@planeXY + \pstThreeDLine[arrows=-](\pst@tempA,\rB,\pst@OffsetZ)(\pst@tempB,\rB,\pst@OffsetZ)% + \else + \ifx\psk@IIIDyTicksPlane\ThreeDplot@planeYZ + \pstThreeDLine[arrows=-](\pst@OffsetX,\rB,\pst@tempA)(\pst@OffsetX,\rB,\pst@tempB)% + \fi\fi + \ifPst@IIIDlabels% + \pstPlanePut[plane=\psk@IIIDyTicksPlane](\pst@tempE,\rB,\pst@OffsetZ){% + \psxyzlabel{\expandafter\@LabelComma\nA..\@nil\psk@ylabelFactor}}% +% \psxyzlabel{\nA\psk@ylabelFactor}}% + \fi% + }% end of multido + \fi% + \ifdim\psk@ThreeDplot@yMin pt<\z@ % only for negative parts of the axes + \pstFPadd\pst@tempB\psk@ThreeDplot@yMin{-\pst@OffsetY} + \pstFPDiv\pst@tempB{\pst@tempB}{\psk@ThreeDplot@deltay} + \pst@cnty=-\pst@tempB + \pstFPdiv\pst@tempB{\psk@IIIDticksize}{\psk@ThreeDplot@yThreeDunit} + \pstFPadd\pst@tempA{-\pst@tempB}{\pst@OffsetX} + \pstFPadd\pst@tempB{\pst@tempB}{\pst@OffsetX} + \pstFPadd\pst@tempC{\pst@OffsetY}{-\psk@ThreeDplot@deltay} + \pstFPadd\pst@tempD{\pst@OffsetY}{-\psk@Dy} + \pst@dimm=\pst@tempD pt\edef\pst@tempD{\strip@pt\pst@dimm}% strip the 00... from fp + \pstFPadd\pst@tempE{\psk@IIIDyticksep}{\pst@OffsetX} + \pstFPdiv\pst@tempE\pst@tempE\psk@ThreeDplot@xThreeDunit + \edef\@xyDecimals{\psk@xDecimals}% + \multido{\nA=\pst@tempD+-\psk@Dy,% + \rB=\pst@tempC+-\psk@ThreeDplot@deltay} + {\the\pst@cnty}{% + \ifx\psk@IIIDyTicksPlane\ThreeDplot@planeXY + \pstThreeDLine[arrows=-](\pst@tempA,\rB,\pst@OffsetZ)(\pst@tempB,\rB,\pst@OffsetZ)% + \else + \ifx\psk@IIIDyTicksPlane\ThreeDplot@planeYZ + \pstThreeDLine[arrows=-](\pst@OffsetX,\rB,\pst@tempA)(\pst@OffsetX,\rB,\pst@tempB)% + \fi\fi + \ifPst@IIIDlabels% + \pstPlanePut[plane=\psk@IIIDyTicksPlane](\pst@tempE,\rB,\pst@OffsetZ){% + \psxyzlabel{\expandafter\@LabelComma\nA..\@nil\psk@ylabelFactor}}% +% \psxyzlabel{\nA\psk@ylabelFactor}}% + \fi + }% end of multido and y ticks and labels + \fi +%------------ z ticks and labels -------------------------- + \ifdim\psk@ThreeDplot@zMax pt>\z@ % only for positive parts of the axes + \ifdim\psk@ThreeDplot@zMin pt>\z@ + \pstFPadd\pst@tempC\psk@ThreeDplot@zMax{-\psk@ThreeDplot@zMin} + \else\let\pst@tempC\psk@ThreeDplot@zMax + \fi% + \pstFPadd\pst@tempC\pst@tempC{-\pst@OffsetZ} + \pstFPDiv\pst@tempB\pst@tempC{\psk@ThreeDplot@deltaz} + \pst@cntz=\pst@int{\pst@tempB} \advance\pst@cntz by -1% + \pstFPdiv\pst@tempB\psk@IIIDticksize{\psk@ThreeDplot@yThreeDunit} + \pstFPadd\pst@tempA{-\pst@tempB}{\pst@OffsetY} + \pstFPadd\pst@tempB{\pst@tempB}{\pst@OffsetY} + \pstFPadd\pst@tempC\pst@OffsetZ{\psk@ThreeDplot@deltaz} + \pstFPadd\pst@tempD\pst@OffsetZ{\psk@Dz} + \pst@dimm=\pst@tempD pt\edef\pst@tempD{\strip@pt\pst@dimm}% strip the 00... from fp + \pstFPadd\pst@tempE{\psk@IIIDzticksep}{\pst@OffsetY} + \pstFPdiv\pst@tempE\pst@tempE\psk@ThreeDplot@yThreeDunit + \edef\@xyDecimals{\psk@xDecimals}% + \multido{\nA=\pst@tempD+\psk@Dz, + \rB=\pst@tempC+\psk@ThreeDplot@deltaz}% + {\the\pst@cntz}{% + \ifx\psk@IIIDzTicksPlane\ThreeDplot@planeYZ + \pstThreeDLine[arrows=-](\pst@OffsetX,\pst@tempA,\rB)(\pst@OffsetX,\pst@tempB,\rB)% + \else + \ifx\psk@IIIDzTicksPlane\ThreeDplot@planeXZ + \pstThreeDLine[arrows=-](\pst@tempA,\pst@OffsetY,\rB)(\pst@tempB,\pst@OffsetY,\rB)% + \fi\fi + \ifPst@IIIDlabels% +% \pshlabel{\psk@labelFontSize\expandafter\@LabelComma##1..\@nil\psk@xlabelFactor}% + \pstPlanePut[plane=\psk@IIIDzTicksPlane](\pst@OffsetX,\pst@tempE,\rB){% + \psxyzlabel{\expandafter\@LabelComma\nA..\@nil\psk@zlabelFactor}}% + \fi% + }% + \fi + \ifdim\psk@ThreeDplot@zMin pt<\z@ % only for negative parts of the axes + \pstFPadd\pst@tempB\psk@ThreeDplot@zMin{-\pst@OffsetZ} + \pstFPDiv\pst@tempB\pst@tempB{\psk@ThreeDplot@deltaz} + \pst@cntz=-\pst@tempB% + \pstFPdiv\pst@tempB\psk@IIIDticksize{\psk@ThreeDplot@yThreeDunit} + \pstFPadd\pst@tempA{-\pst@tempB}{\pst@OffsetY} + \pstFPadd\pst@tempB{\pst@tempB}{\pst@OffsetY} + \pstFPadd\pst@tempC\pst@OffsetZ{-\psk@ThreeDplot@deltaz} + \pstFPadd\pst@tempD\pst@OffsetZ{-\psk@Dz} + \pst@dimm=\pst@tempD pt\edef\pst@tempD{\strip@pt\pst@dimm}% strip the 00... from fp + \pstFPadd\pst@tempE{\psk@IIIDzticksep}{\pst@OffsetY} + \pstFPdiv\pst@tempE\pst@tempE\psk@ThreeDplot@yThreeDunit + \edef\@xyDecimals{\psk@xDecimals}% + \multido{\nA=\pst@tempD+-\psk@Dz,% + \rB=\pst@tempC+-\psk@ThreeDplot@deltaz}{\the\pst@cntz}{% + \ifx\psk@IIIDzTicksPlane\ThreeDplot@planeYZ + \pstThreeDLine[arrows=-](\pst@OffsetX,\pst@tempA,\rB)(\pst@OffsetX,\pst@tempB,\rB)% + \else + \ifx\psk@IIIDzTicksPlane\ThreeDplot@planeXZ + \pstThreeDLine[arrows=-](\pst@tempA,\pst@OffsetY,\rB)(\pst@tempB,\pst@OffsetY,\rB)% + \fi\fi + \ifPst@IIIDlabels% + \pstPlanePut[plane=\psk@IIIDzTicksPlane](\pst@OffsetX,\pst@tempE,\rB){% + \psxyzlabel{\expandafter\@LabelComma\nA..\@nil\psk@zlabelFactor}}% +% \psxyzlabel{\nA\psk@zlabelFactor}}% + \fi% + }% end \multido + \fi% end \ifdim\psk@ThreeDplot@zMin + \fi% end \ifPst@IIIDticks% + \fi% end \ifPst@drawing + \endgroup% + \ignorespaces% +} +% +% planeGrids +% +\newdimen\pst@dx\newdimen\pst@dy +\def\pstThreeDPlaneGrid{\def\pst@par{}\pst@object{pstThreeDPlaneGrid}} +\def\pstThreeDPlaneGrid@i(#1,#2)(#3,#4){{% + \pst@killglue + \use@par + \pssetxlength\pst@dima{#1} + \pssetxlength\pst@dimb{#3} + \advance\pst@dimb by -\pst@dima + \divide\pst@dimb by \psk@xsubticks + \pst@dx=\pst@dimb +% + \pssetylength\pst@dima{#2} + \pssetylength\pst@dimb{#4} + \advance\pst@dimb by -\pst@dima + \divide\pst@dimb by \psk@ysubticks + \pst@dy=\pst@dimb +% + \pssetylength\pst@dimx{#2} + \pssetylength\pst@dimy{#4} + \pssetylength\pst@dimz{#1} + \pssetylength\pst@dimf{#3} + \pst@getlength\psk@planeGridOffset\pst@dima + \pst@cntx=\psk@xsubticks \advance\pst@cntx by \@ne + \pst@cnty=\psk@ysubticks \advance\pst@cnty by \@ne + \psset{unit=1pt} + \psset[pst-3dplot]{planeGridOffset=\pst@dima}% we need everything in pt + \ifx\psk@planeGrid\ThreeDplot@planeXY + \multido{\rA=\strip@pt\pst@dimz+\strip@pt\pst@dx}{\pst@cntx}{% + \pstThreeDLine(\rA,\strip@pt\pst@dimx,\psk@planeGridOffset)% + (\rA,\strip@pt\pst@dimy,\psk@planeGridOffset)} + \multido{\rA=\strip@pt\pst@dimx+\strip@pt\pst@dy}{\pst@cnty}{% + \pstThreeDLine(\strip@pt\pst@dimz,\rA,\psk@planeGridOffset)% + (\strip@pt\pst@dimf,\rA,\psk@planeGridOffset)} + \else + \ifx\psk@planeGrid\ThreeDplot@planeXZ + \multido{\rA=\strip@pt\pst@dimz+\strip@pt\pst@dx}{\pst@cntx}{% + \pstThreeDLine(\rA,\psk@planeGridOffset,\strip@pt\pst@dimx)% + (\rA,\psk@planeGridOffset,\strip@pt\pst@dimy)} + \multido{\rA=\strip@pt\pst@dimx+\strip@pt\pst@dy}{\pst@cnty}{% + \pstThreeDLine(\strip@pt\pst@dimz,\psk@planeGridOffset,\rA)% + (\strip@pt\pst@dimf,\psk@planeGridOffset,\rA)} + \else + \multido{\rA=\strip@pt\pst@dimz+\strip@pt\pst@dx}{\pst@cntx}{% + \pstThreeDLine(\psk@planeGridOffset,\rA,\strip@pt\pst@dimx)% + (\psk@planeGridOffset,\rA,\strip@pt\pst@dimy)} + \multido{\rA=\strip@pt\pst@dimx+\strip@pt\pst@dy}{\pst@cnty}{% + \pstThreeDLine(\psk@planeGridOffset,\strip@pt\pst@dimz,\rA)% + (\psk@planeGridOffset,\strip@pt\pst@dimf,\rA)} + \fi + \fi% +}\ignorespaces} +% +% transform the 3d coordinates of the point (#1,#2,#3) +% into a 2d and moveto +% +\def\pstThreeDmoveto{\def\pst@par{}\pst@object{pstThreeDmoveto}} +\def\pstThreeDmoveto@i(#1,#2,#3){% + \pst@killglue + \begingroup + \addto@pscode{ + \pst@3ddict + \IIIDplot@variables + #1 #2 #3 + \ifPst@SphericalCoor + ConvertToCartesian + \else + \psk@ThreeDplot@zThreeDunit\space mul /z ED + \psk@ThreeDplot@yThreeDunit\space mul /y ED + \psk@ThreeDplot@xThreeDunit\space mul /x ED + \fi + ConvertTo2D x2D y2D end moveto }% + \use@pscode + \def\pst@par{}% + \endgroup +\ignorespaces} +% +% +% put anything at (#2,#3,#4) +% +\def\pstThreeDPut{\@ifnextchar[{\pst@ThreeDPut}{\pst@ThreeDPut[]}} +\def\pst@ThreeDPut[#1](#2,#3,#4)#5{{% + \pst@killglue% + \psset{#1}% + \pstThreeDNode(#2,#3,#4){temp@pstNode}% +% \def\@tempa{c} +% \ifx\pst@ThreeDplot@pOrigin\@tempa% +% \rput(temp@pstNode){#5}% +% \else% + \rput[\psk@ThreeDplot@pOrigin](temp@pstNode){#5}% +% \fi% +}\ignorespaces} +% +% draws a 3d line +% +\def\cartesianIIID@coor#1,#2,#3,#4\@nil{\edef\pst@coor{#1 #2 #3 }} +\def\NormalIIIDCoor{% + \def\pst@@getcoor##1{\pst@expandafter\cartesianIIID@coor{##1}, ,\@nil}% + \def\pst@@getangle##1{% + \pst@checknum{##1}\pst@angle% + \edef\pst@angle{\pst@angle \pst@angleunit}% + }% + \def\psput@##1{\pst@@getcoor{##1}\leavevmode\psput@cartesian}% +}% + +\def\pstThreeDLine{\NormalIIIDCoor\def\pst@par{}\pst@object{pst@lineIIID}} +\def\pst@lineIIID@i{% + \pst@killglue% + \pst@getarrows{% + \begin@OpenObj% + \pst@getcoors[\pst@lineIIID@ii% + }% +} +\def\pst@lineIIID@ii{% + \addto@pscode{% + \pst@3ddict + \IIIDplot@variables +% \psk@ThreeDplot@linejoin setlinejoin + /dxUnit \psk@ThreeDplot@xThreeDunit\space def + /dyUnit \psk@ThreeDplot@yThreeDunit\space def + /dzUnit \psk@ThreeDplot@zThreeDunit\space def + \ifPst@SphericalCoor /SphericalCoor true def + \else /SphericalCoor false def + \fi % + /xUnit { \pst@number\psxunit\space mul } def + /yUnit { \pst@number\psyunit\space mul } def + convertStackTo2D + end + \pst@cp\space \psline@iii\space \tx@Line + }% + \end@OpenObj% + \ignorespaces% + \SpecialCoor% +} +% +% set a 3d dot +% +\def\pstThreeDDot{\def\pst@par{}\pst@object{pstThreeDDot}} +\def\pstThreeDDot@i(#1,#2,#3){% + \begin@SpecialObj + \pstThreeDNode(#1,#2,#3){pst@A} % we need the parameters + \ifx\psk@dotstyle\@none\else\psdots(pst@A)\fi + \ifPst@drawCoor + \psset{style=showCoorStyle} + \addto@pscode{ + \pst@3ddict + \IIIDplot@variables +% \psk@ThreeDplot@linejoin setlinejoin + #1 #2 #3 + \ifPst@SphericalCoor + ConvertToCartesian + \else + \psk@ThreeDplot@zThreeDunit\space mul /z ED + \psk@ThreeDplot@yThreeDunit\space mul /y ED + \psk@ThreeDplot@xThreeDunit\space mul /x ED + \fi + ConvertTo2D + x2D \pst@number\psxunit\space mul + y2D \pst@number\psyunit\space mul + moveto /RotX 0 def /RotY 0 def /RotZ 0 def + /z 0 def + ConvertTo2D /x2DOld x2D def /y2DOld y2D def + x2D \pst@number\psxunit\space mul + y2D \pst@number\psyunit\space mul + lineto + /y@i y def /y 0 def + ConvertTo2D + x2D \pst@number\psxunit\space mul + y2D \pst@number\psyunit\space mul + lineto + x2DOld \pst@number\psxunit\space mul + y2DOld \pst@number\psyunit\space mul + moveto + /y y@i def /x 0 def + ConvertTo2D + x2D \pst@number\psxunit\space mul + y2D \pst@number\psyunit\space mul + lineto + \ifx\pslinestyle\@none\else + gsave + \pst@number\pslinewidth SLW + \pst@usecolor\pslinecolor + \@nameuse{psls@\pslinestyle} + grestore + \fi + end + }% + \fi% + \end@SpecialObj% + \ignorespaces} +% +% transform the 3d coordinates of the node (#1,#2,#3) +% into a 2d node with the name #4 +% +\def\pstThreeDNode{\def\pst@par{}\pst@object{pstThreeDNode}} +\def\pstThreeDNode@i(#1,#2,#3)#4{% + \begin@SpecialObj% +% \def\pst@tempThreeDNode{#1 #2 #3 }% + \pnode(! + \pst@3ddict + \IIIDplot@variables + #1 #2 #3 +% \pst@tempThreeDNode + \ifPst@SphericalCoor + ConvertToCartesian + \else + \psk@ThreeDplot@zThreeDunit\space mul /z ED + \psk@ThreeDplot@yThreeDunit\space mul /y ED + \psk@ThreeDplot@xThreeDunit\space mul /x ED + \fi + ConvertTo2D x2D y2D end ){#4}% + \end@SpecialObj% +\ignorespaces} +% +%\define@key[psset]{pst-3dplot}{nodeType}{\pst@getint{#1}\pst@IIIDNodeType} +%\psset{nodeType=0} +\def\pstIIIDNode{\def\pst@par{}\pst@object{pstIIIDNode}} +\def\pstIIIDNode@i(#1)(#2)(#3)(#4)(#5){% + \@ifnextchar({\pstIIIDNode@iii(#1)(#2)(#3)(#4)(#5)}{\pstIIIDNode@ii(#1)(#2)(#3)(#4)(#5)}} + +\def\pstIIIDNode@ii(#1)(#2)(#3)(#4)(#5)#6{% line and plain. #6 node name + \begin@SpecialObj + \getThreeDCoor{#1}\pst@tempA + \getThreeDCoor{#2}\pst@tempB + \getThreeDCoor{#3}\pst@tempC + \getThreeDCoor{#4}\pst@tempD + \getThreeDCoor{#5}\pst@tempE + \pnode(!% + \pst@3ddict + \IIIDplot@variables +% #1 #2 % a + r vec(m) +% #3 #4 #5 % b + s vec(u) + s vec(v) + [\pst@tempA] [\pst@tempC] % x11 x21 x31 x12 x22 x32 + vector-sub /b ED + /r [\pst@tempB] -1 vector-scale def + /s [\pst@tempD] def + /t [\pst@tempE] def + [ + [ r 0 get s 0 get t 0 get b 0 get ] + [ r 1 get s 1 get t 1 get b 1 get ] + [ r 2 get s 2 get t 2 get b 2 get ] + ] + SolveLinEqSystem aload pop % r s t + pop pop [\pst@tempB] exch vector-scale % r*vec(#2) + [\pst@tempA] vector-add aload pop + /z ED /y ED /x ED + ConvertTo2D x2D y2D end ){#6}% + \end@SpecialObj% +} +\def\pstIIIDNode@iii(#1)(#2)(#3)(#4)(#5)(#6)#7{% plain and plain +} +% +% a 3d uput[](){} +% +\def\pstUThreeDPut{\@ifnextchar[{\pst@UThreeDPut}{\pst@UThreeDPut[]}} +\def\pst@UThreeDPut[#1](#2,#3,#4)#5{{% + \uput[#1](!% + \pst@3ddict + \IIIDplot@variables + \ifPst@SphericalCoor + #2\space #3\space #4\space + ConvertToCartesian + \else + /x #2\space\psk@ThreeDplot@xThreeDunit\space mul def + /y #3\space\psk@ThreeDplot@yThreeDunit\space mul def + /z #4\space\psk@ThreeDplot@zThreeDunit\space mul def + \fi + ConvertTo2D x2D y2D + end ){#5}% +}\ignorespaces} +% +% Trangle [options](Point1)(Point2)(Point3) +\def\pstThreeDTriangle{\def\pst@par{}\pst@object{pst@ThreeDTriangle}} +\def\pst@ThreeDTriangle@i(#1,#2,#3)(#4,#5,#6)(#7,#8,#9){% + \begingroup + \use@par + \ifPst@drawCoor% + \bgroup + \pstThreeDDot[style=showCoorStyle](#1,#2,#3) + \pstThreeDDot[style=showCoorStyle](#4,#5,#6) + \pstThreeDDot[style=showCoorStyle](#7,#8,#9) + \egroup + \fi% + \begin@ClosedObj + \addto@pscode{% + \pst@3ddict + \IIIDplot@variables +% \psk@ThreeDplot@linejoin setlinejoin + /P1 { #1 #2 #3 } def % x y z or Radius longitude lattitude + /P2 { #4 #5 #6 } def % + /P3 { #7 #8 #9 } def % + /SphericalCoor \ifPst@SphericalCoor true \else false \fi def % + /xUnit { \pst@number\psxunit\space mul } def + /yUnit { \pst@number\psyunit\space mul } def + P1 saveCoor + SphericalCoor { ConvertToCartesian } if + ConvertTo2D + /x0 x2D xUnit def /y0 y2D yUnit def + P2 saveCoor + SphericalCoor { ConvertToCartesian } if + ConvertTo2D + /x1 x2D xUnit def /y1 y2D yUnit def + P3 saveCoor + SphericalCoor { ConvertToCartesian } if + ConvertTo2D + /x2 x2D xUnit def /y2 y2D yUnit def + [ x0 y0 x1 y1 x2 y2 x0 y0 + \pst@cp\space \psline@iii\space \tx@Line\space closepath + end + }% + \end@ClosedObj% + \endgroup + \ignorespaces} +% +% draws a threeD square as a polygon +% +% [#1] options +% (#2) starting vector ax,ay,az +% (#3) first direction vector ux,uy,uz +% (#4) second direction vector wx,wy,wz +% +\def\pstThreeDSquare{\def\pst@par{}\pst@object{pstThreeDSquare}} +\def\pstThreeDSquare@i(#1,#2,#3)(#4,#5,#6)(#7,#8,#9){% + \begingroup + \use@keep@par + \ifPst@drawCoor + \pstThreeDDot[style=showCoorStyle](#1,#2,#3)% +% \pst@addThreeDVecPS(#1,#2,#3)(#4,#5,#6)\pst@tempAA\pst@tempBB\pst@tempCC + \pstThreeDDot[style=showCoorStyle](#1 #4 add, #2 #5 add, #3 #6 add)% +% \pst@addThreeDVecPS(#1,#2,#3)(#7,#8,#9)\pst@tempAA\pst@tempBB\pst@tempCC + \pstThreeDDot[style=showCoorStyle](#1 #7 add, #2 #8 add, #3 #9 add)% +% \pst@addThreeDVecPS(\pst@tempAA,\pst@tempBB,\pst@tempCC)(#4,#5,#6)\pst@tempA\pst@tempB\pst@tempC + \pstThreeDDot[style=showCoorStyle](#1 #4 add #7 add, #2 #5 add #8 add, #3 #6 add #9 add)% + \fi% + \endgroup + \begin@ClosedObj + \addto@pscode{ + \pst@3ddict + \IIIDplot@variables +% \psk@ThreeDplot@linejoin setlinejoin + /P1 { #1 #2 #3 } def % x y z or Radius longitude lattitude + /P2 { #4 #5 #6 } def % + /P3 { #7 #8 #9 } def % + \tx@setTransparency + \tx@setStrokeTransparency + /SphericalCoor \ifPst@SphericalCoor true \else false \fi def % + /xUnit { \pst@number\psxunit\space mul } def + /yUnit { \pst@number\psyunit\space mul } def + P1 saveCoor + SphericalCoor { ConvertToCartesian } if + ConvertTo2D + /x0 x2D xUnit def /y0 y2D yUnit def + P2 saveCoor + SphericalCoor { ConvertToCartesian } if + ConvertTo2D + /x1 x2D xUnit x0 add def /y1 y2D yUnit y0 add def + P3 saveCoor + SphericalCoor { ConvertToCartesian } if + ConvertTo2D + /x2 x2D xUnit x1 add def /y2 y2D yUnit y1 add def + P2 saveCoor + SphericalCoor { ConvertToCartesian } if + ConvertTo2D + /x3 x2D xUnit neg x2 add def /y3 y2D yUnit neg y2 add def + [ x0 y0 x1 y1 x2 y2 x3 y3 x0 y0 + \pst@cp\space \psline@iii\space \tx@Line\space closepath + end + }% + \end@ClosedObj% +} +% +% draws a threeD Box +% [#1] options +% (#2) first direction vector ux,uy,uz +% (#3) second direction vector vx,vy,vz +% (#4) third direction vector wx,wy,wz +% +\def\pstThreeDBox{\pst@object{pstThreeDBox}} +\def\pstThreeDBox@i(#1,#2,#3){% + \pst@killglue + \begingroup + \addbefore@par{alternative=false,linestyle=\psk@ThreeDplot@visibleLineStyle}% + \use@keep@par + \gdef\pst@tempX{#1 }% + \gdef\pst@tempY{#2 }% + \gdef\pst@tempZ{#3 }% + \pstThreeDBox@ii +} +\def\pstThreeDBox@ii(#1,#2,#3)(#4,#5,#6)(#7,#8,#9){%%\def\pstThreeDBox@i[#1](#2)(#3)(#4)(#5) +\ifPst@alternative% better support for hidden lines + \pstThreeDSquare(\pst@tempX,\pst@tempY,\pst@tempZ)(#4,#5,#6)(#7,#8,#9) % lower square + \pst@absdim{\psk@ThreeDplot@Alpha pt}\pst@dimo + \ifdim\pst@dimo<90pt + \ifdim\pst@dimo>270pt + \pstThreeDSquare(\pst@tempX,\pst@tempY,\pst@tempZ)(#1,#2,#3)(#4,#5,#6)% back square + \else + \pstThreeDSquare(\pst@tempX #7 add,\pst@tempY #8 add,\pst@tempZ #9 add)(#1,#2,#3)(#4,#5,#6)% front square + \fi + \else + \ifdim\pst@dimo>270pt + \pstThreeDSquare(\pst@tempX #7 add,\pst@tempY #8 add,\pst@tempZ #9 add)(#1,#2,#3)(#4,#5,#6)% front square + \else + \pstThreeDSquare(\pst@tempX,\pst@tempY,\pst@tempZ)(#1,#2,#3)(#4,#5,#6)% back square + \fi + \fi + \ifPst@hiddenLine\psset{linestyle=\psk@ThreeDplot@invisibleLineStyle}\fi + \pstThreeDSquare(\pst@tempX #4 add,\pst@tempY #5 add,\pst@tempZ #6 add)(#1,#2,#3)(#7,#8,#9)% left square + \pstThreeDSquare(\pst@tempX #1 add,\pst@tempY #2 add,\pst@tempZ #3 add)(#4,#5,#6)(#7,#8,#9)% top square + \ifdim\pst@dimo<90pt + \ifdim\pst@dimo>270pt + \pstThreeDSquare(\pst@tempX #7 add,\pst@tempY #8 add,\pst@tempZ #9 add)(#1,#2,#3)(#4,#5,#6)% front square + \else + \pstThreeDSquare(\pst@tempX,\pst@tempY,\pst@tempZ)(#1,#2,#3)(#4,#5,#6)% back square + \fi + \else + \ifdim\pst@dimo>270pt + \pstThreeDSquare(\pst@tempX,\pst@tempY,\pst@tempZ)(#1,#2,#3)(#4,#5,#6)% back square + \else + \pstThreeDSquare(\pst@tempX #7 add,\pst@tempY #8 add,\pst@tempZ #9 add)(#1,#2,#3)(#4,#5,#6)% front square + \fi + \fi% +\else + \ifnum\psk@ThreeDplot@coorType=3 + \ifPst@hiddenLine + \psset{linestyle=\psk@ThreeDplot@invisibleLineStyle} + \pstThreeDLine(\pst@tempX,\pst@tempY,\pst@tempZ)(\pst@tempX #1 add,\pst@tempY,\pst@tempZ)(\pst@tempX #1 add,\pst@tempY #5 add,\pst@tempZ) + \pstThreeDLine(\pst@tempX #1 add,\pst@tempY,\pst@tempZ)(\pst@tempX #1 add,\pst@tempY,\pst@tempZ #9 add) + \psset{linestyle=\psk@ThreeDplot@visibleLineStyle} + \else + \pstThreeDSquare(\pst@tempX,\pst@tempY,\pst@tempZ)(#1,#2,#3)(#4,#5,#6)% bottom square + \pstThreeDSquare(\pst@tempX #1 add,\pst@tempY #2 add,\pst@tempZ #3 add)(#4,#5,#6)(#7,#8,#9)% left square + \fi + \pstThreeDSquare(\pst@tempX #4 add,\pst@tempY #5 add,\pst@tempZ #6 add)(#1,#2,#3)(#7,#8,#9)% right square + \pstThreeDSquare(\pst@tempX #7 add,\pst@tempY #8 add,\pst@tempZ #9 add)(#1,#2,#3)(#4,#5,#6)% top square + \pstThreeDSquare(\pst@tempX,\pst@tempY,\pst@tempZ)(#4,#5,#6)(#7,#8,#9)% right square + \else + \ifnum\psk@ThreeDplot@coorType=5 + \ifPst@hiddenLine + \psset{linestyle=\psk@ThreeDplot@invisibleLineStyle} + \pstThreeDLine(\pst@tempX,\pst@tempY,\pst@tempZ)(\pst@tempX,\pst@tempY,\pst@tempZ #9 add)(\pst@tempX #1 add,\pst@tempY,\pst@tempZ #9 add) + \pstThreeDLine(\pst@tempX,\pst@tempY,\pst@tempZ #9 add)(\pst@tempX,\pst@tempY #5 add,\pst@tempZ #9 add) + \psset{linestyle=\psk@ThreeDplot@visibleLineStyle} + \else + \pstThreeDSquare(\pst@tempX #7 add,\pst@tempY #8 add,\pst@tempZ #9 add)(#1,#2,#3)(#4,#5,#6)% top square + \pstThreeDSquare(\pst@tempX,\pst@tempY,\pst@tempZ)(#4,#5,#6)(#7,#8,#9)% right square + \fi + \pstThreeDSquare(\pst@tempX,\pst@tempY,\pst@tempZ)(#1,#2,#3)(#4,#5,#6)% bottom square + \pstThreeDSquare(\pst@tempX #4 add,\pst@tempY #5 add,\pst@tempZ #6 add)(#1,#2,#3)(#7,#8,#9)% top square + \pstThreeDSquare(\pst@tempX #1 add,\pst@tempY #2 add,\pst@tempZ #3 add)(#4,#5,#6)(#7,#8,#9)% left square + \else + \pstThreeDSquare(\pst@tempX #1 add,\pst@tempY #2 add,\pst@tempZ #3 add)(#4,#5,#6)(#7,#8,#9)% left square + \pstThreeDSquare(\pst@tempX #4 add,\pst@tempY #5 add,\pst@tempZ #6 add)(#1,#2,#3)(#7,#8,#9)% front square + \pstThreeDSquare(\pst@tempX #7 add,\pst@tempY #8 add,\pst@tempZ #9 add)(#1,#2,#3)(#4,#5,#6)% top square + \ifPst@hiddenLine +% \psset{} + \pstThreeDLine[linestyle=\psk@ThreeDplot@invisibleLineStyle](\pst@tempX #1 add,\pst@tempY,\pst@tempZ)(\pst@tempX,\pst@tempY,\pst@tempZ)(\pst@tempX,\pst@tempY #5 add,\pst@tempZ) + \pstThreeDLine[linestyle=\psk@ThreeDplot@invisibleLineStyle](\pst@tempX,\pst@tempY,\pst@tempZ)(\pst@tempX,\pst@tempY,\pst@tempZ #9 add) +% \psset{linestyle=\psk@ThreeDplot@visibleLineStyle} + \else + \pstThreeDSquare(\pst@tempX,\pst@tempY,\pst@tempZ)(#1,#2,#3)(#4,#5,#6)% bottom square + \pstThreeDSquare(\pst@tempX,\pst@tempY,\pst@tempZ)(#4,#5,#6)(#7,#8,#9)% right square + \fi + \fi + \fi +\fi + \endgroup + \ignorespaces +} +% + + + +\define@key[psset]{pst-3dplot}{height}[5]{\def\psk@height{#1 }} +\define@key[psset]{pst-3dplot}{move}[0 0]{\def\psk@move{#1 }} +\psset{height=5,move=0 0} +\def\pstThreeDPrism{\NormalIIIDCoor\def\pst@par{}\pst@object{prismIIID}} +\def\prismIIID@i{% + \pst@killglue% + \pst@getarrows{% + \begin@OpenObj% + \pst@getcoors[\prismIIID@ii}} +\def\prismIIID@ii{% + \addto@pscode{% + \pst@3ddict + \IIIDplot@variables + /dxUnit \psk@ThreeDplot@xThreeDunit\space def + /dyUnit \psk@ThreeDplot@yThreeDunit\space def + /dzUnit \psk@ThreeDplot@zThreeDunit\space def + \ifPst@SphericalCoor /SphericalCoor true def + \else /SphericalCoor false def + \fi % + /xUnit { \pst@number\psxunit\space mul } def + /yUnit { \pst@number\psyunit\space mul } def + counttomark array astore /3dValues ED + 3dValues aload pop + convertStackTo2D + end + \pst@cp\space \psline@iii\space \tx@Line + \pst@3ddict + \psk@move /y0 ED /x0 ED + [ 3dValues aload length dup /n ED 3 div cvi + { \psk@height add 3 1 roll y0 add 3 1 roll x0 add 3 1 roll + n -3 roll } repeat + n array astore /3dValuesMove ED + 3dValuesMove aload pop + convertStackTo2D + end + \pst@cp\space \psline@iii\space \tx@Line + \pst@3ddict + 0 3 n { + /Index ED + 3dValues Index 3 getinterval aload pop + SphericalCoor { ConvertToCartesian } { saveCoor } ifelse + ConvertTo2D x2D xUnit y2D yUnit moveto + 3dValuesMove Index 3 getinterval aload pop + SphericalCoor { ConvertToCartesian } { saveCoor } ifelse + ConvertTo2D x2D xUnit y2D yUnit lineto + } for + end + }% + \end@OpenObj% + \ignorespaces% + \SpecialCoor} +% +% set a 3d ellipse/circle +% +% #1 options +% #2 center cx,cy,cz +% #3 radius ax,ay,az +% #4 radius bx,by,bz +% +\def\pstThreeDEllipse{\def\pst@par{}\pst@object{pstThreeDEllipse}} +\def\pstThreeDEllipse@i(#1)(#2)(#3){% + \addbefore@par{plotstyle=curve}% + \@nameuse{beginplot@\psplotstyle}% + \getThreeDCoor{#1}\pst@tempC% center + \getThreeDCoor{#2}\pst@tempA% a + \getThreeDCoor{#3}\pst@tempB% b + \addto@pscode{% + \pst@3ddict \IIIDplot@variables end +% \psk@ThreeDplot@linejoin setlinejoin + \ifPst@SphericalCoor + \pst@tempC\space \tx@ConvertToCartesian + /zM \tx@Z def /yM \tx@Y def /xM \tx@X def % center + \pst@tempA\space \tx@ConvertToCartesian + /zA \tx@Z def /yA \tx@Y def /xA \tx@X def % a + \pst@tempB\space \tx@ConvertToCartesian + /zB \tx@Z def /yB \tx@Y def /xB \tx@X def % b + \else + \pst@tempC\space /zM ED /yM ED /xM ED % center + \pst@tempA\space /zA ED /yA ED /xA ED % a + \pst@tempB\space /zB ED /yB ED /xB ED % b + \fi + /aStart \psk@ThreeDplot@beginAngle\space def +% /aEnd \psk@ThreeDplot@endAngle\space dup aStart lt { 360 add } if def +% /da aEnd aStart sub \psk@plotpoints\space div abs def + /aEnd \psk@ThreeDplot@endAngle\space def + /da aEnd aStart sub \psk@plotpoints\space div def + \pst@3ddict + /vecA [xA yA zA] vector-length def + /vecB [xB yB zB] vector-length def + end + /xyz { + \pst@3ddict % +% +% the angle in the parameter equation is not proportional to the real angle! +% phi=atan(b*tan(angle)/a)+floor(angle/180+0.5)*180 +% + /phi angle cvi 90 mod 0 eq { angle } { vecA angle tan mul vecB atan + angle 180 div .5 add floor 180 mul add } ifelse def + xM xA phi cos mul add xB phi sin mul add + yM yA phi cos mul add yB phi sin mul add + zM zA phi cos mul add zB phi sin mul add + saveCoor ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end + } def + /angle aStart def + }% + \gdef\psplot@init{}% + \@pstfalse% + \@nameuse{testqp@\psplotstyle}% + \if@pst\pstThreeDEllipse@ii\else\pstThreeDEllipse@iii\fi% + \ignorespaces} +% +\def\pstThreeDEllipse@ii{% + \addto@pscode{% + xyz \@nameuse{beginqp@\psplotstyle} + \psk@plotpoints 1 sub { + /angle angle da add def + xyz \@nameuse{doqp@\psplotstyle} + } repeat + /angle aEnd def + xyz \@nameuse{doqp@\psplotstyle} + }% + \@nameuse{endqp@\psplotstyle}} + +\def\pstThreeDEllipse@iii{% + \addto@pscode{% + mark + /n 2 def + \psk@plotpoints { + xyz + n 2 roll + /n n 2 add def + /angle angle da add def + } repeat + /angle aEnd def + xyz + n 2 roll + }% + \@nameuse{endplot@\psplotstyle}} +% +\def\pstThreeDCircle{\def\pst@par{}\pst@object{pstThreeDCircle}} +\def\pstThreeDCircle@i(#1)(#2)(#3){% (vec O)(vec a)(vec b) + \addbefore@par{plotstyle=curve}% + \@nameuse{beginplot@\psplotstyle}% + \getThreeDCoor{#1}\pst@tempC% center + \getThreeDCoor{#2}\pst@tempA% a + \getThreeDCoor{#3}\pst@tempB% b + \addto@pscode{% + \pst@3ddict \IIIDplot@variables end +% \psk@ThreeDplot@linejoin setlinejoin + \ifPst@SphericalCoor + \pst@tempC\space \tx@ConvertToCartesian + /zM \tx@Z def /yM \tx@Y def /xM \tx@X def % center + \pst@tempA\space \tx@ConvertToCartesian + /zA \tx@Z def /yA \tx@Y def /xA \tx@X def % a + \pst@tempB\space \tx@ConvertToCartesian + /zB \tx@Z def /yB \tx@Y def /xB \tx@X def % b + \else + \pst@tempC\space /zM ED /yM ED /xM ED % center + \pst@tempA\space /zA ED /yA ED /xA ED % a + \pst@tempB\space /zB ED /yB ED /xB ED % b + \fi +% build the orthogonal part of B to vec A + \pst@3ddict + /vecA [xA yA zA] vector-length def + /vecB [xB yB zB] vector-length def + [xA yA zA] [xB yB zB] vector-mul vecA div vecB div % is cos(alpha) + vecB mul % is |b_parallelA| + [xA yA zA] vector-unit exch vector-scale % is b_parallelA + [xB yB zB] exch vector-sub % is b-bparallelA=b_orthA + dup vector-length vecA exch div vector-scale % is b_orthA with |a| + aload pop + /zB ED /yB ED /xB ED + /vecB [xB yB zB] vector-length def + end + /aStart \psk@ThreeDplot@beginAngle\space def + /aEnd \psk@ThreeDplot@endAngle\space def + /da aEnd aStart sub \psk@plotpoints\space div def + /xyz { + \pst@3ddict % +% +% the angle in the parameter equation is not proportional to the real angle! +% phi=atan(b*tan(angle)/a)+floor(angle/180+0.5)*180 +% + /phi angle cvi 90 mod 0 eq { angle } { vecA angle tan mul vecB atan + angle 180 div .5 add floor 180 mul add } ifelse def + xM xA phi cos mul add xB phi sin mul add + yM yA phi cos mul add yB phi sin mul add + zM zA phi cos mul add zB phi sin mul add + saveCoor ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end + } def + /angle aStart def + }% + \gdef\psplot@init{}% + \@pstfalse% + \@nameuse{testqp@\psplotstyle}% + \if@pst\pstThreeDEllipse@ii\else\pstThreeDEllipse@iii\fi% + \ignorespaces} +% +\def\pstThreeDPlotFunc{\psplotThreeD}% only for compatibility +% +% cone[options](center)(radiusA vec)(radiusB vec){height} +% +\def\pstThreeDCone{\def\pst@par{}\pst@object{pstThreeDCone}} +\def\pstThreeDCone@i(#1)(#2)(#3)#4{{% + \use@par + \pstThreeDEllipse(#1)(#2)(#3)% + \begin@OpenObj% + \getThreeDCoor{#1}\pst@tempA% + \getThreeDCoor{#2}\pst@tempB% + \getThreeDCoor{#3}\pst@tempC% + \addto@pscode{ + \pst@3ddict + \IIIDplot@variables +% \psk@ThreeDplot@linejoin setlinejoin + /xUnit { \pst@number\psxunit\space mul } def + /yUnit { \pst@number\psyunit\space mul } def + /SphericalCoor \ifPst@SphericalCoor true \else false \fi def % + /Center [ \pst@tempA\space SphericalCoor { ConvertToCartesian } if ] def % x y z or Radius longitude lattitude + Center aload pop saveCoor ConvertTo2D /xC x2D def /yC y2D def + /rA [ \pst@tempB \space SphericalCoor { ConvertToCartesian } if ] def + /rB [ \pst@tempC \space SphericalCoor { ConvertToCartesian } if ] def + rA rB AxB UnitVec #4 AmulC Center AaddB aload pop + saveCoor ConvertTo2D /x2 x2D xUnit def /y2 y2D yUnit def + [ xC rA VecNorm add 90 Beta sub sin sub xUnit yC Beta sin add yUnit + x2 y2 + xC rA VecNorm sub xUnit yC yUnit + \pst@cp\space \psline@iii\space \tx@Line\space end }% + \end@OpenObj% +}\ignorespaces} +% +\def\pstRotNodeIIID{\def\pst@par{}\pst@object{RotNodeIIID}} +\def\RotNodeIIID@i(#1,#2,#3)(#4,#5,#6)#7{% + \pst@killglue + \begingroup% + \use@par% + \def\pst@ThreeDplot@ThetaX{#4}% rotating angle + \def\pst@ThreeDplot@ThetaY{#5}% rotating angle + \def\pst@ThreeDplot@ThetaZ{#6}% rotating angle + \pnode(!% + \pst@3ddict + \IIIDplot@variables + \ifPst@SphericalCoor + #1\space #2\space #3\space + ConvertToCartesian + \else + /x #1\space\psk@ThreeDplot@xThreeDunit\space mul def + /y #2\space\psk@ThreeDplot@yThreeDunit\space mul def + /z #3\space\psk@ThreeDplot@zThreeDunit\space mul def + \fi + ConvertTo2D x2D y2D + end ){#7}% + \endgroup% + \ignorespaces} +% +% Paraboloid (Idea is from Manuel ... ) +% +\def\tx@SetMatrixThreeD{tx@3Ddict begin SetMatrixThreeD end } + +\def\pstParaboloid{\def\pst@par{}\pst@object{pstParaboloid}} +\def\pstParaboloid@i{\@ifnextchar(\pstParaboloid@ii{\pstParaboloid@ii(0,0,0)}} +\def\pstParaboloid@ii(#1,#2,#3)#4#5{% #1:height #2:radius +\addto@par{viewpoint=0 0 0}% +\begin@SpecialObj% +\addto@pscode{% + tx@3DPlotDict begin + \IIIDplot@variables + #1 #2 #3 + saveCoor + ConvertTo2DWithoutRotating + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end + translate + /height #4 def + /radius #5 #4 sqrt div def + /increment \psk@ThreeDplot@increment\space def + /viewpoint { + \psk@viewpoint + \ifcase\psk@ThreeDplot@coorType + \psk@ThreeDplot@Beta\space sin add 3 1 roll + \psk@ThreeDplot@Alpha\space cos add \psk@ThreeDplot@Beta\space cos mul 3 1 roll + \psk@ThreeDplot@Alpha\space sin add \psk@ThreeDplot@Beta\space cos mul 3 1 roll + \or + 3 1 roll + \psk@ThreeDplot@Alpha\space cos add 3 1 roll + \psk@ThreeDplot@Alpha\space sin add 3 1 roll + \else + 3 1 roll 45 cos add 3 1 roll 45 sin add 3 1 roll + \fi + } def + 0 viewpoint 0 \tx@SetMatrixThreeD + viewpoint + \pst@3ddict /vZ ED /vY ED /vX ED + /pas 0.5 def + /pas10 pas 10 div def + /cmyk {} def % we need only the values + \psk@ThreeDplot@SegmentColor\space +% \psk@ThreeDplot@xyzLight\space % xLight yLight zLight +% + /calculate2DPoint { % four values on stack; x2D y2D are returned + /V0 ED /Z0 ED /U20 ED /U10 ED + U10 cos V0 mul radius mul + U20 sin V0 mul radius mul + Z0 + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end + } def + /condition { PSfacetteParaboloid 0 le } def + true MaillageParaboloid + /condition { PSfacetteParaboloid 0 ge } def + false MaillageParaboloid + \ifPstThreeDplot@showInside + /condition { PSfacetteParaboloid 0 ge } def + false MaillageParaboloid + vZ 0 ge { + PlanCoupeParaboloid 1 0.5 0.5 setrgbcolor fill + PlanCoupeParaboloid 0 setgray stroke } if + \fi + end +}% +% fin du code ps + \showpointsfalse% + \end@SpecialObj% +\ignorespaces} +% +% Sphere, the new one +\def\pstThreeDSphere{\def\pst@par{}\pst@object{pstSphereIIID}} +\def\pstSphereIIID@i(#1,#2,#3)#4{% #1:origin (x,y,z) #2:radius +\addto@par{viewpoint=0 0 0}% to make it compatible with pst-3dplot +\begin@SpecialObj% +\use@par +\addto@pscode{% +% \psk@ThreeDplot@linejoin setlinejoin + /viewpoint {% to make it compatible with parallel projection + \psk@viewpoint + \ifcase\psk@ThreeDplot@coorType + \psk@ThreeDplot@Beta\space sin add 3 1 roll + \psk@ThreeDplot@Alpha\space cos add \psk@ThreeDplot@Beta\space cos mul 3 1 roll + \psk@ThreeDplot@Alpha\space sin add \psk@ThreeDplot@Beta\space cos mul 3 1 roll + \or + \psk@ThreeDplot@Beta\space sin add 3 1 roll + \psk@ThreeDplot@Alpha\space cos add 3 1 roll + \psk@ThreeDplot@Alpha\space sin add 3 1 roll + \else + \psk@ThreeDplot@Beta\space sin add 3 1 roll + 45 cos add 3 1 roll + 45 sin add 3 1 roll + \fi + } def + 0 viewpoint 0 \tx@SetMatrixThreeD + viewpoint /vZ ED /vY ED /vX ED +% on stack must be +% x y z Radius increment C M Y K + #1 \pst@number\psunit mul #2 \pst@number\psunit mul #3 \pst@number\psunit mul + #4 \pst@number\psunit mul + \psk@ThreeDplot@increment\space + /cmyk {} def % we need only the values + \psk@ThreeDplot@SegmentColor\space + tx@3DPlotDict begin + \IIIDplot@variables + \tx@setTransparency + \tx@setStrokeTransparency + MaillageSphere + end +}% fin du code ps + \showpointsfalse% + \end@SpecialObj% +\ignorespaces} +% +\def\pstIIIDCylinder{\pst@object{pstIIIDCylinder}} +\def\pstIIIDCylinder@i{\@ifnextchar({\pstIIIDCylinder@ii}{\pstIIIDCylinder@ii(0,0,0)}} +\def\pstIIIDCylinder@ii(#1,#2,#3)#4#5{{% + \let\pst@parOrig\pst@par% + \begin@ClosedObj% + \addto@pscode{% + tx@3DPlotDict begin + \IIIDplot@variables + #1 #2 #3 \ifPst@CylindricalCoor \tx@ConvCylToCartesian \fi + saveCoor + ConvertTo2D +% ConvertTo2DWithoutRotating + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul + translate % the lower center + #4 \pst@number\psunit mul dup 0 360 false + \pst@usecolor{\pslinecolor} + IIIDEllipse + end + }% end of pscode + \end@ClosedObj + \let\pst@par\pst@parOrig + \begin@SpecialObj % bottom + \addto@pscode{% + tx@3DPlotDict begin + \IIIDplot@variables + #1 #2 #3 \ifPst@CylindricalCoor \tx@ConvCylToCartesian \fi + saveCoor + ConvertTo2D +% ConvertTo2DWithoutRotating + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul + translate + #4 \pst@number\psunit mul % radius + #5 \pst@number\psunit mul % height + 0 360 % for the future + \psk@ThreeDplot@increment + false % wedge? + \tx@setTransparency + \tx@setStrokeTransparency + IIIDCylinder + end + }% end of pscode + \end@SpecialObj + \let\pst@par\pst@parOrig + \begin@ClosedObj % top + \addto@pscode{% + tx@3DPlotDict begin + \IIIDplot@variables + #1 #2 #3 #5 add \ifPst@CylindricalCoor \tx@ConvCylToCartesian \fi + saveCoor + ConvertTo2D +% ConvertTo2DWithoutRotating + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul + translate + #4 \pst@number\psunit mul dup 0 360 false + \pst@usecolor{\pslinecolor} + \tx@setTransparency + \tx@setStrokeTransparency + IIIDEllipse + end + }% end of pscode + \end@ClosedObj +}\ignorespaces} +% +%-------------------------- Cylinder ---------------------------- +% +\def\psCylinder{\def\pst@par{}\pst@object{psCylinder}} +\def\psCylinder@i{\@ifnextchar(\psCylinder@ii{\psCylinder@ii(0,0,0)}} +\def\psCylinder@ii(#1,#2,#3)#4#5{% #1,#2,#3: center of the bottom #4:radius #5:height +\addto@par{viewpoint=0 0 0}% +\pssetlength\pst@dima{#4} +\pssetlength\pst@dimb{#5} +\begin@SpecialObj% +\use@par +\addto@pscode { + /viewpoint { + \psk@viewpoint + \ifcase\psk@ThreeDplot@coorType + \psk@ThreeDplot@Beta\space sin add 3 1 roll + \psk@ThreeDplot@Alpha\space cos add \psk@ThreeDplot@Beta\space cos mul 3 1 roll + \psk@ThreeDplot@Alpha\space sin add \psk@ThreeDplot@Beta\space cos mul 3 1 roll + \or + 3 1 roll + \psk@ThreeDplot@Alpha\space cos add 3 1 roll + \psk@ThreeDplot@Alpha\space sin add 3 1 roll + \else + 3 1 roll 45 cos add 3 1 roll 45 sin add 3 1 roll + \fi + } def + 0 viewpoint 0 \tx@SetMatrixThreeD + viewpoint + \pst@3ddict /vZ ED /vY ED /vX ED + \IIIDplot@variables end +% \psk@ThreeDplot@linejoin setlinejoin +% + #1 #2 #3 \ifPst@CylindricalCoor \tx@ConvCylToCartesian \fi + \pst@number\pst@dima \pst@number\psxunit div % Radius + \pst@number\pst@dimb \pst@number\psyunit div % Height + \psk@ThreeDplot@increment % angle increment + \psk@ThreeDplot@Hincrement % height increment + /cmyk {} def % we need only the values + \psk@ThreeDplot@SegmentColor\space +% + \tx@3DPlotDict + \tx@setTransparency + \tx@setStrokeTransparency + /ConvCyl2d { % on stack r phi h + ConvCylToCartesian + CZ add /z ED CY add /y ED CX add /x ED + RotatePoint x y z Conv3D2D + \pst@number\psyunit mul exch + \pst@number\psxunit mul exch + } def % on stack x y + /condition { PSfacetteCylinder 0 le } def % inside + true MaillageCylinder % save paras + /condition { PSfacetteCylinder 0 ge } def % outside + false MaillageCylinder % use old paras + \ifPstThreeDplot@showInside\else + vZ 0 ge { % viewpoint coor + PlanCoupeCylinder 1 0.5 0.5 setrgbcolor fill + PlanCoupeCylinder 0 setgray stroke } if + \fi + end + }% +% fin du code ps + \showpointsfalse% + \end@SpecialObj% +\ignorespaces} +% +%-------------------------- Box ---------------------------- +% +\def\psBox{\def\pst@par{}\pst@object{psBox}} +\def\psBox@i{\@ifnextchar(\psBox@ii{\psBox@ii(0,0,0)}} +\def\psBox@ii(#1,#2,#3)#4#5#6{% #1,#2,#3: center of the lower left edge + % #4:width #5:height #6:depth + \addto@par{viewpoint=0 0 0}% + \pssetlength\pst@dima{#4}\pssetlength\pst@dimb{#5}\pssetlength\pst@dimc{#6} + \begin@SpecialObj% + \addto@pscode { + /viewpoint { + \psk@viewpoint + \ifcase\psk@ThreeDplot@coorType + \psk@ThreeDplot@Beta\space sin add 3 1 roll + \psk@ThreeDplot@Alpha\space cos add \psk@ThreeDplot@Beta\space cos mul 3 1 roll + \psk@ThreeDplot@Alpha\space sin add \psk@ThreeDplot@Beta\space cos mul 3 1 roll + \or + 3 1 roll + \psk@ThreeDplot@Alpha\space cos add 3 1 roll + \psk@ThreeDplot@Alpha\space sin add 3 1 roll + \else + 3 1 roll 45 cos add 3 1 roll 45 sin add 3 1 roll + \fi + } def + 0 viewpoint 0 \tx@SetMatrixThreeD + viewpoint + \tx@3DPlotDict + /vZ ED /vY ED /vX ED + \IIIDplot@variables +% \psk@ThreeDplot@linejoin setlinejoin +% + #1 2 div #2 2 div #3 2 div % wieso 1/2 ???? + \pst@number\pst@dima \pst@number\psxunit div % Width + \pst@number\pst@dimb \pst@number\psyunit div % Height + \pst@number\pst@dimc \pst@number\psyunit div % Depth + /cmyk {} def % we need only the values + \psk@ThreeDplot@SegmentColor\space +% + /PlaneSequence [ \psk@ThreeD@PlaneSequence ] def + /ConvBox2d { % on stack x y z + CZ add /z ED CY add /y ED CX add /x ED + RotatePoint x y z Conv3D2D + \pst@number\psyunit mul exch + \pst@number\psxunit mul exch + } def % on stack x y + /condition { PSfacetteBox 0 le } def % inside + true MaillageBox % save paras + /condition { PSfacetteBox 0 ge } def % outside + false MaillageBox % use old paras + \ifPstThreeDplot@showInside\else + vZ 0 ge { % viewpoint coor + PlanCoupeBox 1 0.5 0.5 setrgbcolor fill +% /Height 0 def + PlanCoupeBox 0 setgray stroke } if + \fi + end + }% +% fin du code ps + \showpointsfalse% + \end@SpecialObj% +\ignorespaces} +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\def\psplotinit#1{\xdef\psplot@init{#1 }} +\def\psplot@init{} +% +%\def\psplotThreeD{\@ifnextchar[{\ps@plotThreeD}{\ps@plotThreeD[]}} +\def\psplotThreeD{\def\pst@par{}\pst@object{psplotThreeD}} +\def\psplotThreeD@i(#1,#2)(#3,#4)#5{{% + \pst@killglue + \use@par% + \ifcase\psk@ThreeDplot@drawStyle% + \psplotThreeD@xLines(#1,#2)(#3,#4){#5}\or% + \psplotThreeD@yLines(#1,#2)(#3,#4){#5}\or + \psplotThreeD@xLines(#1,#2)(#3,#4){#5}% + \psplotThreeD@yLines(#1,#2)(#3,#4){#5}\or% + \psplotThreeD@yLines(#1,#2)(#3,#4){#5}% + \psplotThreeD@xLines(#1,#2)(#3,#4){#5}% + \fi% +}\ignorespaces} +% +\def\psplotThreeD@xLines(#1,#2)(#3,#4)#5{% + \pst@killglue% + \begingroup% +% \use@par% + \@pstfalse% + \@nameuse{beginplot@\psplotstyle}% + \gdef\psplot@init{}% + \@nameuse{testqp@\psplotstyle}% + \if@pst% lines and dots + \addto@pscode{ + \IIIDplot@variables + /func { #5 } def + \ifPst@algebraic /Func ( #5 ) %tx@Dict begin + AlgParser %end + cvx def \fi + /xMin #1 def + /x xMin def + /x1 #2 def + /y #3 def + /y1 #4 def + /dx x1 x sub \psk@ThreeDplot@xPlotpoints\space dup 0 gt {div}{pop} ifelse def + /dy y1 y sub \psk@ThreeDplot@yPlotpoints\space dup 0 gt {div}{pop} ifelse def + /xyz { + x \psk@ThreeDplot@zCoor\space 0 gt { \ifPst@algebraic Func \else func \fi }{ y } ifelse + \psk@ThreeDplot@zCoor\space 0 gt { \psk@ThreeDplot@zCoor }{ \ifPst@algebraic Func \else func \fi } ifelse + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def + }% + \psplotThreeD@xLines@ii + \else% curves + \endgroup% + \multido{\n@Y=0+1}{\psk@ThreeDplot@yPlotpoints}{% + \ifPst@hiddenLine\pscustom[style=hiddenStyle]{\fi% + \@nameuse{beginplot@\psplotstyle}% + \addto@pscode{ + \IIIDplot@variables + /func { #5 } def + \ifPst@algebraic /Func ( #5 ) + AlgParser + cvx def \fi + /xMin #1 def + /x xMin def + /x1 #2 def + /dx x1 x sub \psk@ThreeDplot@xPlotpoints\space dup 0 gt {div}{pop} ifelse def + /dy #4\space #3\space sub \psk@ThreeDplot@yPlotpoints\space dup 0 gt {div}{pop} ifelse def + /y #3\space \n@Y\space dy mul add def + /xyz { + x \psk@ThreeDplot@zCoor\space 0 gt { \ifPst@algebraic Func \else func \fi }{ y } ifelse + \psk@ThreeDplot@zCoor\space 0 gt { \psk@ThreeDplot@zCoor }{ \ifPst@algebraic Func \else func \fi } ifelse + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def + }% + \psplotThreeD@xLines@iii% + \ifPst@hiddenLine }\fi% + }% + \fi% + \endgroup% + \ignorespaces% +} +% +\def\psplotThreeD@xLines@ii{% + \addto@pscode{% + xyz \@nameuse{beginqp@\psplotstyle} + \psk@ThreeDplot@yPlotpoints\space 1 add { + /x xMin def + xyz moveto + \psk@ThreeDplot@xPlotpoints\space 1 add { + xyz \@nameuse{doqp@\psplotstyle} + /x x dx add def + } repeat + /y y dy add def + } repeat + /x x1 def + /y y1 def + xyz \@nameuse{doqp@\psplotstyle} + }% + \@nameuse{endqp@\psplotstyle}% +} +\def\psplotThreeD@xLines@iii{% curves + \addto@pscode{% + /x xMin def + mark + /n 2 def + \psk@ThreeDplot@xPlotpoints { + xyz + n 2 roll + /n n 2 add def + /x x dx add def + } repeat + /x x1 def + xyz + n 2 roll + }% + \@nameuse{endplot@\psplotstyle}% +} +% +\def\psplotThreeD@yLines(#1,#2)(#3,#4)#5{% + \pst@killglue + \begingroup +% \use@par% + \@pstfalse + \@nameuse{beginplot@\psplotstyle}% + \gdef\psplot@init{}% + \@nameuse{testqp@\psplotstyle}% + \if@pst% lines and dots + \addto@pscode{% + \IIIDplot@variables + /func { #5 } def + \ifPst@algebraic /Func (#5) + AlgParser + cvx def \fi + /x #1 def + /x1 #2 def + /yMin #3 def + /y yMin def + /y1 #4 def + /dx x1 x sub \psk@ThreeDplot@xPlotpoints\space dup 0 gt {div}{pop} ifelse def + /dy y1 y sub \psk@ThreeDplot@yPlotpoints\space dup 0 gt {div}{pop} ifelse def + /xyz { + x \psk@ThreeDplot@zCoor\space 0 gt { \ifPst@algebraic Func \else func \fi }{ y } ifelse + \psk@ThreeDplot@zCoor\space 0 gt { \psk@ThreeDplot@zCoor }{ \ifPst@algebraic Func \else func \fi } ifelse + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def + }% + \psplotThreeD@yLines@ii + \else% curves + \endgroup + \multido{\n@X=0+1}{\psk@ThreeDplot@xPlotpoints}{% + \ifPst@hiddenLine\pscustom[style=hiddenStyle]{\fi + \@nameuse{beginplot@\psplotstyle}% + \addto@pscode{% + \IIIDplot@variables + /func { #5 } def + \ifPst@algebraic /Func (#5) + AlgParser + cvx def \fi + /yMin #3 def + /y yMin def + /y1 #4 def + /dy y1 y sub \psk@ThreeDplot@yPlotpoints\space dup 0 gt {div}{pop} ifelse def + /dx #2\space #1\space sub \psk@ThreeDplot@xPlotpoints\space dup 0 gt {div}{pop} ifelse def + /x #1\space \n@X\space dx mul add def + /xyz { + x \psk@ThreeDplot@zCoor\space 0 gt { \ifPst@algebraic Func \else func \fi }{ y } ifelse + \psk@ThreeDplot@zCoor\space 0 gt { \psk@ThreeDplot@zCoor }{ \ifPst@algebraic Func \else func \fi } ifelse + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def + }% + \psplotThreeD@yLines@iii% + \ifPst@hiddenLine }\fi% + }% + \fi + \endgroup + \ignorespaces% +} +\def\psplotThreeD@yLines@ii{% + \addto@pscode{% + xyz \@nameuse{beginqp@\psplotstyle} + \psk@ThreeDplot@xPlotpoints\space 1 add { + /y yMin def + xyz moveto + \psk@ThreeDplot@yPlotpoints\space 1 add { + xyz \@nameuse{doqp@\psplotstyle} + /y y dy add def + } repeat + /x x dx add def + } repeat + /x x1 def + /y y1 def + xyz \@nameuse{doqp@\psplotstyle} + }% + \@nameuse{endqp@\psplotstyle}% +} +\def\psplotThreeD@yLines@iii{% curves + \addto@pscode{% + /y yMin def + mark + /n 2 def + \psk@ThreeDplot@yPlotpoints { + xyz + n 2 roll + /n n 2 add def + /y y dy add def + } repeat + /y y1 def + xyz + n 2 roll + }% + \@nameuse{endplot@\psplotstyle}% +} +% +% parametricplot ---------------------------------------------------------------- +% +\def\parametricplotThreeD{\def\pst@par{}\pst@object{parametricPlotThreeD}} +\def\parametricPlotThreeD@i(#1){% + \@ifnextchar({\parametricPlotThreeD@ii(#1)}{\parametricPlotThreeD@ii(#1)(0,0)}% +} +\def\parametricPlotThreeD@ii(#1,#2)(#3,#4)#5{{% + \pst@killglue% + \use@par% + \ifPst@CoorCheck% + \pst@dima=#3pt\pst@dimb=#4pt % #3=#4, then we have a 3d line + \ifdim\pst@dima=\pst@dimb + \def\psk@ThreeDplot@yPlotpoints{1 }\fi% and set yPlotpoints=1 + \fi% + \@pstfalse% + \@nameuse{beginplot@\psplotstyle}% + \@nameuse{testqp@\psplotstyle}% quick plot or something special + \if@pst% + \ifPst@Debug\typeout{===>Quick plot}\fi + \def\pslinetype{0}% + \addto@pscode{% + \IIIDplot@variables + \ifPst@algebraic /Func (#5) + AlgParser + cvx def \fi + /tMin #1 def + /t tMin def + /t1 #2 def + /u #3 def + /u1 #4 def + /dt t1 t sub \psk@ThreeDplot@xPlotpoints\space dup 1 gt % + { 1 sub div }{ pop pop 0 } ifelse def % step for t + /du u1 u sub \psk@ThreeDplot@yPlotpoints\space dup 1 gt % + { 1 sub div }{ pop pop 0 } ifelse def % step for u + /xyz { \ifPst@algebraic Func \else #5 \fi + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def + }% + \parametricPlotThreeD@iii% + \else% + \ifPst@Debug\typeout{===>Special plot}\fi + \def\pslinetype{0}% + \endgroup% + \multido{\n@Y=0+1}{\psk@ThreeDplot@yPlotpoints}{% + \@nameuse{beginplot@\psplotstyle}% + \addto@pscode{% + \IIIDplot@variables + \ifPst@algebraic /Func (#5) + AlgParser + cvx def \fi + /tMin #1 def + /t tMin def + /t1 #2 def + /u1 #2 def + /dt t1 t sub \psk@ThreeDplot@xPlotpoints\space dup 1 gt % + { 1 sub div }{ pop pop 0 } ifelse def % step for t + /du #4\space #3\space sub \psk@ThreeDplot@yPlotpoints\space dup 1 gt % + { 1 sub div }{ pop pop 0 } ifelse def % step for t + /u #3\space \n@Y\space du mul add def + /xyz { \ifPst@algebraic Func \else #5 \fi + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def + }% + \parametricPlotThreeD@iv% + }% + \fi% +}\ignorespaces} +% +\def\parametricPlotThreeD@iii{% without arrows (quickplot) + \addto@pscode{% + \psk@ThreeDplot@yPlotpoints { + /t tMin def + xyz \@nameuse{beginqp@\psplotstyle} + /t t dt add def + \psk@ThreeDplot@xPlotpoints\space 1 sub { + xyz \@nameuse{doqp@\psplotstyle} + /t t dt add def + } repeat + /t t dt sub def + /u u du add def + } repeat + }% + \@nameuse{endqp@\psplotstyle}% +} +% +\def\parametricPlotThreeD@iv{% with arrows or curve + \addto@pscode{% +% /t tMin def + mark + /n 0 def + \psk@ThreeDplot@xPlotpoints\space { + xyz + /n n 2 add def + n 2 roll + /t t dt add def + } repeat +% /t t1 def +% /u u1 def +% xyz +% n 2 roll + }% + \@nameuse{endplot@\psplotstyle}% +} +% +%------------------------ Plot 3D data -------------------------- +% +\def\fileplotThreeD{\def\pst@par{}\pst@object{fileplotThreeD}} +\def\fileplotThreeD@i#1{% + \pst@killglue% + \begingroup% + \use@par% + \@pstfalse% + \@nameuse{testqp@\psplotstyle}%% + \if@pst + \dataplotThreeD@ii{\pst@readfile{#1}}% + \else + \listplotThreeD@ii{\pst@altreadfile{#1}}% + \fi + \endgroup% + \ignorespaces% +} +% +% dataplot +% +\def\dataplotThreeD{\def\pst@par{}\pst@object{dataplotThreeD}} +\def\dataplotThreeD@i#1{% + \pst@killglue + \begingroup + \use@par + \@pstfalse + \@nameuse{testqp@\psplotstyle}% + \if@pst + \dataplotThreeD@ii{\addto@pscode{#1}}% + \else + \listplot@ii{\addto@pscode{#1}}% + \fi + \endgroup + \ignorespaces% +} +\def\dataplotThreeD@ii#1{% + \@nameuse{beginplot@\psplotstyle}% + \addto@pscode{% + \IIIDplot@variables + /Dx { /D { Dy } def } def + /Dy { /D { Dz } def } def + /Dz { % now we have x y z + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul + end + Do /D { Dx } def } def + /D { /D { Dx } def } def + /Do { + \@nameuse{beginqp@\psplotstyle}% + /Do { \@nameuse{doqp@\psplotstyle}} def + } def}% + #1% + \addto@pscode{D}% + \@nameuse{endqp@\psplotstyle}% +} +% +% +\pst@def{ScalePointsThreeD}<% + counttomark dup dup cvi eq not { exch pop } if + /m exch def /n m 3 div cvi def + n { % now we have x y z + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul + end + m 1 sub 1 roll m 1 sub 1 roll /m m 3 sub def } repeat> +% +% listplotThreeD +% +\def\listplotThreeD{\def\pst@par{}\pst@object{listplotThreeD}} +\def\listplotThreeD@i#1{\listplotThreeD@ii{\addto@pscode{#1}}} +\def\listplotThreeD@ii#1{% + \@nameuse{beginplot@\psplotstyle}% + \addto@pscode{ \IIIDplot@variables /D {} def mark }% + #1% + \addto@pscode{\tx@ScalePointsThreeD}% + \@nameuse{endplot@\psplotstyle}% +} +% +% adopted from pst-3d +% +\pst@def{TMSave}<% + tx@Dict /TMatrix known not { /TMatrix { } def /RAngle { 0 } def } if + /TMatrix [ TMatrix CM ] cvx def> +% +\pst@def{TMRestore}<% + CP /TMatrix [ TMatrix setmatrix ] cvx def moveto> +% +\pst@def{TMChange}<% + \tx@TMSave + /cp [ currentpoint ] cvx def + CM + CP T \tx@STV + CM matrix invertmatrix + matrix concatmatrix + exch exec + concat cp moveto> +% +\def\pstPlanePut{\@ifnextchar[{\pst@PlanePut}{\pst@PlanePut[]}} +\def\pst@PlanePut[#1](#2)#3{{% + \pst@killglue% + \psset{pOrigin=lB}% + \psset{#1}% + \pstThreeDPut[#1](#2){\ps@Plane{#3}}% +}} +% +\def\ps@Plane{\pst@makebox{\psPlane@}} +\def\psPlane@{% + \begingroup + \leavevmode% + \hbox{% +% \kern\wd\pst@hbox% + \pst@Verb{% + { [ 1 0 + \IIIDplot@variables +% +% ### begin Torsten Suhling +% ------------------------------------------------------------------------ +% =================================================================== +% How should 'Alpha' be for planes, if real Alpha and Beta are: +% Alpha Beta xy xy (par. y-axis) yz xz +% ------------------------------------------------------------------- +% 75 > 0[1] 180 + Alpha 90 + Alpha Alpha Alpha + 180 +% 165 > 0 Alpha 90 + Alpha Alpha Alpha +% 255 > 0 Alpha 270 + Alpha Alpha + 180 Alpha +% 345 > 0 180 + Alpha 270 + Alpha Alpha + 180 Alpha + 180 +% ------------------------------------------------------------------- +% 75 < 0 180 - Alpha 270 - Alpha Alpha Alpha + 180 +% 165 < 0 -Alpha 270 - Alpha Alpha Alpha +% +% 255 < 0 -Alpha 90 - Alpha Alpha + 180 Alpha +% +% 345 < 0 180 -Alpha 90 - Alpha Alpha + 180 Alpha + 180 +% ------------------------------------------------------------------ +% How should 'Beta' be for planes, if real Alpha and Beta are: +% Alpha Beta xy xy (par. y-axis) yz xz +% ------------------------------------------------------------------- +% 75 > 0 Beta Beta Beta[2] Beta +% 165 > 0 Beta Beta Beta Beta +% 255 > 0 Beta Beta Beta Beta +% 345 > 0 Beta Beta Beta Beta +% ................................................................... +% 75 < 0 -Beta -Beta Beta Beta +% 165 < 0 -Beta -Beta Beta Beta +% 255 < 0 -Beta -Beta Beta Beta +% 345 < 0 -Beta -Beta Beta Beta +% ================================================================ + \ifx\psk@ThreeDplot@planecorr\ThreeDplot@planecorrNone + /SignFlag 1 def + /AlphaOffset 0 \psk@IIIDdAlpha add def + \else% + \ifx\psk@ThreeDplot@plane\ThreeDplot@planeXY % XY-layer's tag + \ifx\psk@ThreeDplot@planecorr\ThreeDplot@planecorrXYrot % Tag written parallel y-axis + Beta sin 0 lt {/SignFlag -1}{/SignFlag 1}ifelse def + Alpha sin 0 gt {/AlphaOffset 180 -90 SignFlag mul add} + {/AlphaOffset 180 90 SignFlag mul add} ifelse def + \else% % Normal (par. x-axis) + Beta sin 0 gt {/SignFlag 1}{/SignFlag -1}ifelse def + Alpha cos 0 gt {/AlphaOffset 180}{/AlphaOffset 0}ifelse def + \fi% + \else % Vertical layers + \ifx\psk@ThreeDplot@plane\ThreeDplot@planeYZ % YZ-layer's tag + /SignFlag 1 def + Alpha sin 0 gt {/AlphaOffset 0}{/AlphaOffset 180}ifelse def + \else% % XZ-layer's tag + /SignFlag 1 def + Alpha cos 0 gt {/AlphaOffset 180}{/AlphaOffset 0}ifelse def + \fi% which vert. layer's tag + \fi% vert. or xy-layer's tag + \fi% planecorr or not +% ------------------------------------------------------------------ Ende +% ------------------------------------------------------------------------ +% ### Aenderung --> es werden die Operatoren SignFlag und AlphaOffset +% eingefuegt +% ------------------------------------------------------------------------ +% /Delta Beta sin Alpha sin mul Alpha cos atan neg 90 add def +% /Gamma Beta sin Alpha cos mul neg Alpha sin atan def +% ------------------------------------------------------------------------ + /Delta Beta SignFlag mul sin Alpha SignFlag mul AlphaOffset add sin mul Alpha SignFlag mul AlphaOffset add cos atan neg 90 add def + /Gamma Beta SignFlag mul sin Alpha SignFlag mul AlphaOffset add cos mul neg Alpha SignFlag mul AlphaOffset add sin atan def +% ------------------------------------------------------------------- Ende + \ifx\psk@ThreeDplot@plane\ThreeDplot@planeXY + 270 Delta sub rotate + /Rho 90 Gamma add Delta add def + \else% + \ifx\psk@ThreeDplot@plane\ThreeDplot@planeXZ + 270 Delta sub rotate + /Rho 180 Delta add def + \else% + Gamma rotate + /Rho 90 Gamma sub def + \fi% + \fi% + Rho cos Rho sin 0 0 ] concat} \tx@TMChange% + }% + \box\pst@hbox% + \pst@Verb{\tx@TMRestore}% +% \kern\ht\pst@hbox% + }% + \endgroup% +} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Utility stuff +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\iffalse +% posStart=Starting point +% length= Arrow length. +\def\Arrows{\@ifnextchar[{\pst@Arrows}{\pst@Arrows[]}} +\def\pst@Arrows[#1](#2)(#3){{% + \psset{#1}% + \pst@getcoor{#2}\pst@tempa + \pst@getcoor{#3}\pst@tempb + \pnode(!% + /StartArrow \psk@ThreeDplot@posStart\space def + /LengthArrow \psk@ThreeDplot@length\space def + \pst@tempa /YA exch \pst@number\psyunit div def + /XA exch \pst@number\psxunit div def + \pst@tempb /YB exch \pst@number\psyunit div def + /XB exch \pst@number\psxunit div def + /denominateur XB XA sub def + /numerateur YB YA sub def + /angleDirectionAB numerateur denominateur Atan def + /XD StartArrow angleDirectionAB cos mul XA add def + /YD StartArrow angleDirectionAB sin mul YA add def + /XF XD LengthArrow angleDirectionAB cos mul add def + /YF YD LengthArrow angleDirectionAB sin mul add def + XD YD ){ArrowStart} + \pnode(! XF YF){ArrowEnd} + \psset{arrows=->}% + \psline[#1](ArrowStart)(ArrowEnd)% +}\ignorespaces} +% +% draw a line (===) outside: #2-----#3=======#4 +% +\def\psOutLine{\@ifnextchar[{\pst@ToDrawOut}{\pst@ToDrawOut[]}} +\def\pst@ToDrawOut[#1](#2)(#3)#4{{% + \psset{#1}% + \pst@getcoor{#2}\pst@tempa + \pst@getcoor{#3}\pst@tempb + \pnode(!% + /LengthArrow \psk@ThreeDplot@length\space def + \pst@tempa /YA exch \pst@number\psyunit div def + /XA exch \pst@number\psxunit div def + \pst@tempb /YB exch \pst@number\psyunit div def + /XB exch \pst@number\psxunit div def + /denominateur XB XA sub def + /numerateur YB YA sub def + /angleDirectionAB numerateur denominateur Atan def + /Xend XB LengthArrow angleDirectionAB cos mul add def + /Yend YB LengthArrow angleDirectionAB sin mul add def + Xend Yend){#4} + \psline[#1](#3)(#4) +}\ignorespaces} +% +% draw a line (===) before: #4========#2-----#3 +% +\def\psBeforeLine{\@ifnextchar[{\pst@BeforeLine}{\pst@BeforeLine[]}} +\def\pst@BeforeLine[#1](#2)(#3)#4{{% + \psset{#1}% + \pst@getcoor{#2}\pst@tempa + \pst@getcoor{#3}\pst@tempb + \pnode(!% + /LengthArrow \psk@ThreeDplot@length\space def + \pst@tempa /YA exch \pst@number\psyunit div def + /XA exch \pst@number\psxunit div def + \pst@tempb /YB exch \pst@number\psyunit div def + /XB exch \pst@number\psxunit div def + /denominateur XB XA sub def + /numerateur YB YA sub def + /angleDirectionAB numerateur denominateur Atan def + /Xstart XA LengthArrow angleDirectionAB cos mul sub def + /Ystart YA LengthArrow angleDirectionAB sin mul sub def + Xstart Ystart){#4} + \psline[#1](#4)(#2)% +}\ignorespaces} +% +% intersection de deux droites +% 2 juillet 2001/ rewritten 2003-01-27 Herbert +% +\def\ABinterCD(#1)(#2)(#3)(#4)#5{% + \pst@getcoor{#1}\pst@tempa + \pst@getcoor{#2}\pst@tempb + \pst@getcoor{#3}\pst@tempc + \pst@getcoor{#4}\pst@tempd +\pnode(!% + /YA \pst@tempa exch pop \pst@number\psyunit div def + /XA \pst@tempa pop \pst@number\psxunit div def + /YB \pst@tempb exch pop \pst@number\psyunit div def + /XB \pst@tempb pop \pst@number\psxunit div def + /YC \pst@tempc exch pop \pst@number\psyunit div def + /XC \pst@tempc pop \pst@number\psxunit div def + /YD \pst@tempd exch pop \pst@number\psyunit div def + /XD \pst@tempd pop \pst@number\psxunit div def + /dY1 YB YA sub def + /dX1 XB XA sub def + /dY2 YD YC sub def + /dX2 XD XC sub def + dX1 abs 0.01 lt { + /m2 dY2 dX2 div def + XA dup XC sub m2 mul YC add + }{ + dX2 abs 0.01 lt { + /m1 dY1 dX1 div def + XC dup XA sub m1 mul YA add + }{% + /m1 dY1 dX1 div def + /m2 dY2 dX2 div def + m1 XA mul m2 XC mul sub YA sub YC add m1 m2 sub div dup + XA sub m1 mul YA add + } ifelse + } ifelse ){#5} +} +% +% draw a parallel line +% #2---------#3 +% #4----------#5(new) +\def\Parallel{\@ifnextchar[{\pst@Parallel}{\pst@Parallel[]}} +\def\pst@Parallel[#1](#2)(#3)(#4)#5{{% + \psset{#1}% + \pst@getcoor{#2}\pst@tempa + \pst@getcoor{#3}\pst@tempb + \pst@getcoor{#4}\pst@tempc + \pnode(!% + /LengthArrow \psk@ThreeDplot@length\space def + \pst@tempa /YA exch \pst@number\psyunit div def + /XA exch \pst@number\psxunit div def + \pst@tempb /YB exch \pst@number\psyunit div def + /XB exch \pst@number\psxunit div def + \pst@tempc /YC exch \pst@number\psyunit div def + /XC exch \pst@number\psxunit div def + /denominateur XB XA sub def + /numerateur YB YA sub def + /angleDirectionAB numerateur denominateur Atan def + /XstartParallel XC LengthArrow angleDirectionAB cos mul add def + /YstartParallel YC LengthArrow angleDirectionAB sin mul add def + XstartParallel YstartParallel){#5} + \psline[#1](#4)(#5) +}\ignorespaces} +% +% arrowLine[options](A)(B){n} +% #2---->---->---->---->----#3 #4-arrows inside +\def\arrowLine{\@ifnextchar[{\pst@arrowLine}{\pst@arrowLine[]}} +\def\pst@arrowLine[#1](#2)(#3)#4{{% + \psset{arrowsize=4pt,arrows=->}% the defaults + \psset{#1}% + \def\pst@ThreeDplot@n{#4}% + \pst@getcoor{#2}\pst@tempa + \pst@getcoor{#3}\pst@tempb + \pnode(!% + /YA \pst@tempa exch pop \pst@number\psyunit div def + /XA \pst@tempa pop \pst@number\psxunit div def + /YB \pst@tempb exch pop \pst@number\psyunit div def + /XB \pst@tempb pop \pst@number\psxunit div def + /dY YB YA sub \pst@ThreeDplot@n\space 1 add div def + /dX XB XA sub \pst@ThreeDplot@n\space 1 add div def + /Alpha dY dX atan def + /dYOffset \psk@ThreeDplot@arrowOffset\space Alpha sin mul def + /dXOffset \psk@ThreeDplot@arrowOffset\space Alpha cos mul def + XA YA ){tempArrowC} + \multido{\i=1+1}{#4}{% + \pnode(!% + XA dX \i\space mul add dXOffset add + YA dY \i\space mul add dYOffset add ){tempArrowB} + \psline(tempArrowC)(tempArrowB) + \pnode(tempArrowB){tempArrowC} + } + \psline[arrows=-](tempArrowB)(#3) +}\ignorespaces} +% +% #1------#3------#2 +\def\nodeBetween(#1)(#2)#3{% Herbert 2003/01/05 + \pst@getcoor{#1}\pst@tempa + \pst@getcoor{#2}\pst@tempb + \pnode(!% + /XA \pst@tempa pop \pst@number\psxunit div def + /YA \pst@tempa exch pop \pst@number\psyunit div def + /XB \pst@tempb pop \pst@number\psxunit div def + /YB \pst@tempb exch pop \pst@number\psyunit div def + XB XA add 2 div YB YA add 2 div){#3} +} +\fi%-------------------------------------------------------- +% +% rotateNode(A) +% (A) the node +% #2 the angle +% Herbert Voss <voss@perce.de> 2003-01-26 +\def\rotateNode{\pst@rotateNode} +\def\pst@rotateNode(#1)#2{{% + \pst@getcoor{#1}\pst@tempa% + \def\pst@ThreeDplot@angle{#2}% the rotating angle + \pnode(!% + /YA \pst@tempa exch pop \pst@number\psyunit div def + /XA \pst@tempa pop \pst@number\psxunit div def + YA 0 eq XA 0 eq and {0 0}{ + /r XA dup mul YA dup mul add sqrt def + /AlphaOld YA XA atan def + /AlphaNew AlphaOld \pst@ThreeDplot@angle\space add def + r AlphaNew cos mul r AlphaNew sin mul + } ifelse ){temp}% + \pnode(temp){#1}% +}\ignorespaces} +% +\def\rotateTriangle{\pst@rotateTriangle} +\def\pst@rotateTriangle(#1)(#2)(#3)#4{{% + \rotateNode(#1){#4}% + \rotateNode(#2){#4}% + \rotateNode(#3){#4}% +}\ignorespaces} +% +\def\rotateFrame{\pst@rotateFrame} +\def\pst@rotateFrame(#1)(#2)(#3)(#4)#5{{% + \rotateNode(#1){#5}% + \rotateNode(#2){#5}% + \rotateNode(#3){#5}% + \rotateNode(#4){#5}% +}\ignorespaces} +% +% An add macro for integer values +% \pstAdd{34}{6}\value ==> \value is 30 +% +\def\pstAdd#1#2#3{% + \begingroup% + \pst@dima=#1pt + \advance\pst@dima by #2pt + \edef\pst@value{\endgroup\def\noexpand#3{\pst@number\pst@dima}}\pst@value% +} +\def\pstSub#1#2#3{% + \begingroup% + \pst@dima=#1pt\relax + \pst@dimb=#2pt\relax + \advance\pst@dima by -\pst@dimb + \edef\pst@value{\endgroup% + \def\noexpand#3{\pst@number\pst@dima}}\pst@value% +} +% An mul macro for real values +% \pstmul{2.5}{1,5}\value ==> \value is 6.25 +% +\def\pstMul#1#2#3{% + \begingroup% + \pst@dima=#1pt\relax + \pst@dimb=#2\pst@dima\relax + \edef\pst@value{\endgroup + \def\noexpand#3{\pst@number\pst@dimb}}\pst@value% +} +% +\let\pstDiv\pst@divide +% +\chardef\nin@ty=90% stolen from the trig.sty package by David Carlisle +\chardef\@clxx=180 +\chardef\@lxxi=71 +\mathchardef\@mmmmlxviii=4068 +\chardef\@coeffz=72 +\chardef\@coefb=42 +\mathchardef\@coefc=840 +\mathchardef\@coefd=5040 +{\catcode`t=12\catcode`p=12\gdef\noPT#1pt{#1}} +\def\TG@rem@pt#1{\expandafter\noPT\the#1\space} +\def\TG@term#1{% + \dimen@\@tempb\dimen@ + \advance\dimen@ #1\p@} +\def\TG@series{% + \dimen@\@lxxi\dimen@ + \divide \dimen@ \@mmmmlxviii + \edef\@tempa{\TG@rem@pt\dimen@}% + \dimen@\@tempa\dimen@ + \edef\@tempb{\TG@rem@pt\dimen@}% + \divide\dimen@\@coeffz + \advance\dimen@\m@ne\p@ + \TG@term\@coefb + \TG@term{-\@coefc}% + \TG@term\@coefd + \dimen@\@tempa\dimen@ + \divide\dimen@ \@coefd} +\def\CalculateSin#1{{% + \expandafter\ifx\csname sin(\number#1)\endcsname\relax + \dimen@=#1\p@\TG@@sin + \expandafter\xdef\csname sin(\number#1)\endcsname + {\TG@rem@pt\dimen@}% + \fi}} +\def\CalculateCos#1{{% + \expandafter\ifx\csname cos(\number#1)\endcsname\relax + \dimen@=\nin@ty\p@ + \advance\dimen@-#1\p@ + \TG@@sin + \expandafter\xdef\csname cos(\number#1)\endcsname + {\TG@rem@pt\dimen@}% + \fi}} +\def\TG@reduce#1#2{% +\dimen@#1#2\nin@ty\p@ + \advance\dimen@#2-\@clxx\p@ + \dimen@-\dimen@ + \TG@@sin} +\def\TG@@sin{% + \ifdim\TG@reduce>+% + \else\ifdim\TG@reduce<-% + \else\TG@series\fi\fi}% +\def\UseSin#1{\csname sin(\number#1)\endcsname} +\def\UseCos#1{\csname cos(\number#1)\endcsname} +\chardef\z@num\z@ +\expandafter\let\csname sin(0)\endcsname\z@num +\expandafter\let\csname cos(0)\endcsname\@ne +\expandafter\let\csname sin(90)\endcsname\@ne +\expandafter\let\csname cos(90)\endcsname\z@num +\expandafter\let\csname sin(-90)\endcsname\m@ne +\expandafter\let\csname cos(-90)\endcsname\z@num +\expandafter\let\csname sin(180)\endcsname\z@num +\expandafter\let\csname cos(180)\endcsname\m@ne + +% A macro for sin cos values +% \pstSinCos{30}\SinVal\CosVal ==> \SinVal 0.5 \CosVal 0.86 + % +\def\pstSinCos#1#2#3{% +%\begingroup% +% \pst@getsinandcos{#1} +% \edef\pst@values{\endgroup% +% \def\noexpand#2{\ifcase\pst@quadrant\or\or-\or-\fi\pst@sin}% +% \def\noexpand#3{\ifcase\pst@quadrant\or-\or-\or\fi\pst@cos}}\pst@values% + \CalculateSin#1 + \CalculateCos#1 + \edef#2{\UseSin#1}% + \edef#3{\UseCos#1}% +} +% +\def\pstRotPointIIID{\def\pst@par{}\pst@object{RotPointIIID}}% A real TeX solution +\def\RotPointIIID@i(#1,#2,#3)#4#5#6{% + \pst@killglue% + \begingroup% + \use@par% +% x- axis + \pstSinCos{\psk@ThreeD@RotX}\pst@sinTheta\pst@cosTheta + \def\pst@xVala{#1} + \pstMul{#2}{\pst@cosTheta}\pst@tempA + \pstMul{#3}{\pst@sinTheta}\pst@tempB + \pstSub{\pst@tempA}{\pst@tempB}\pst@yVala + \pstMul{#2}{\pst@sinTheta}\pst@tempA + \pstMul{#3}{\pst@cosTheta}\pst@tempB + \pstAdd{\pst@tempA}{\pst@tempB}\pst@zVala +% y- axis + \pstSinCos{\psk@ThreeD@RotY}\pst@sinTheta\pst@cosTheta + \pstMul{\pst@xVala}{\pst@cosTheta}\pst@tempA + \pstMul{\pst@zVala}{\pst@sinTheta}\pst@tempB + \pstAdd{\pst@tempA}{\pst@tempB}\pst@xValb + \let\pst@yValb\pst@yVala + \pstMul{\pst@xVala}{\pst@sinTheta}\pst@tempA + \pstMul{\pst@zVala}{\pst@cosTheta}\pst@tempB + \pstSub{\pst@tempB}{\pst@tempA}\pst@zValb +% z- axis + \pstSinCos{\psk@ThreeD@RotZ}\pst@sinTheta\pst@cosTheta + \pstMul{\pst@xValb}{\pst@cosTheta}\pst@tempA + \pstMul{\pst@yValb}{\pst@sinTheta}\pst@tempB + \pstSub{\pst@tempA}{\pst@tempB}\pst@xValc + \pstMul{\pst@xValb}{\pst@sinTheta}\pst@tempA + \pstMul{\pst@yValb}{\pst@cosTheta}\pst@tempB + \pstAdd{\pst@tempA}{\pst@tempB}\pst@yValc + \let\pst@zValc\pst@zValb + % + \edef\pst@values{\endgroup% + \def\noexpand#4{\pst@xValc}% + \def\noexpand#5{\pst@yValc}% + \def\noexpand#6{\pst@zValc}}\pst@values% + \ignorespaces% +} +% +\define@key[psset]{pst-3dplot}{stepFactor}[0.67]{\pst@checknum{#1}\psk@stepFactor } +\psset[pst-3dplot]{stepFactor=0.67} +% +\newdimen\pszunit \pszunit 1cm +% +\def\psplotImpIIID{\pst@object{psplotImpIIID}}% 20060420 +\def\psplotImpIIID@i(#1,#2,#3)(#4,#5,#6){% + \@ifnextchar[{\psplotImpIIID@ii(#1,#2,#3)(#4,#5,#6)}{\psplotImpIIID@ii(#1,#2,#3)(#4,#5,#6)[]}} +\def\psplotImpIIID@ii(#1,#2,#3)(#4,#5,#6)[#7]#8{% + \begin@OpenObj% + \addto@pscode{ + /xMin #1 def + /xMax #4 def + /yMin #2 def + /yMax #5 def + /zMin #3 def + /zMax #6 def + \IIIDplot@variables + #7 % additional PS code + /Func \ifPst@algebraic (#8) AlgParser cvx \else { #8 } \fi def + /xPixel xMax xMin sub \pst@number\psxunit mul round cvi def + /yPixel yMax yMin sub \pst@number\psyunit mul round cvi def + /zPixel zMax zMin sub \pst@number\pszunit mul round cvi def + /dx xMax xMin sub xPixel div def + /dy yMax yMin sub yPixel div def + /dz zMax zMin sub zPixel div def + /setpixel { + dz div 3 1 roll + dy div 3 1 roll + dx div 3 1 roll + tx@3DPlotDict begin Conv3D2D end + \pst@number\pslinewidth 2 div 0 360 arc fill } bind def +% + /VZ true def % suppose that F(x,y,z)>=0 + /x xMin def /y yMin def /z zMin def + Func 0.0 lt { /VZ false def } if % erster Wert + xMin dx \psk@stepFactor\space mul xMax { + /x exch def + yMin dy \psk@stepFactor\space mul yMax { + /y exch def + zMin dz \psk@stepFactor\space mul zMax { + /z exch def + Func 0 lt + { VZ { x y z setpixel /VZ false def} if } + { VZ {}{ x y z setpixel /VZ true def } ifelse } ifelse + } for + } for + } for +% + /x xMin def /y yMin def /z zMin def + Func 0.0 lt { /VZ false def } if % erster Wert + zMin dz \psk@stepFactor\space mul zMax { + /z exch def + yMin dy \psk@stepFactor\space mul yMax { + /y exch def + xMin dx \psk@stepFactor\space mul xMax { + /x exch def + Func 0 lt + { VZ { x y z setpixel /VZ false def} if } + { VZ {}{ x y z setpixel /VZ true def } ifelse } ifelse + } for + } for + } for + }% + \end@OpenObj% +} +% +\catcode`\@=\PstAtCode\relax +% +%% END: pst-3dplot.tex +\endinput + |