From d331d84212f7e8a9a94c72b42111cbbbf622c883 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 16 Nov 2007 11:26:36 +0000 Subject: pst-3dplot update from ctan git-svn-id: svn://tug.org/texlive/trunk@5459 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/generic/pst-3dplot/pst-3dplot.tex | 452 ++++++++++++--------- 1 file changed, 260 insertions(+), 192 deletions(-) (limited to 'Master/texmf-dist/tex/generic/pst-3dplot') diff --git a/Master/texmf-dist/tex/generic/pst-3dplot/pst-3dplot.tex b/Master/texmf-dist/tex/generic/pst-3dplot/pst-3dplot.tex index ddc1e59632f..e28d3c0564f 100644 --- a/Master/texmf-dist/tex/generic/pst-3dplot/pst-3dplot.tex +++ b/Master/texmf-dist/tex/generic/pst-3dplot/pst-3dplot.tex @@ -25,8 +25,8 @@ \ifx\PSTricksAddLoaded\endinput\else\input pstricks-add.tex\fi \ifx\PSTMultidoLoaded\endinput\else\input multido.tex\fi % -\def\fileversion{1.75} -\def\filedate{2007/08/15} +\def\fileversion{1.77} +\def\filedate{2007/10/03} \message{`PST-3dplot' v\fileversion, \filedate\space (HV)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -86,32 +86,32 @@ % % ------- the global definitions for the pspicture frame ------ % -\define@key[psset]{pst-3dplot}{xMin}{\def\psk@ThreeDplot@xMin{#1}} -\define@key[psset]{pst-3dplot}{xMax}{\def\psk@ThreeDplot@xMax{#1}} -\define@key[psset]{pst-3dplot}{yMin}{\def\psk@ThreeDplot@yMin{#1}} -\define@key[psset]{pst-3dplot}{yMax}{\def\psk@ThreeDplot@yMax{#1}} -\define@key[psset]{pst-3dplot}{zMin}{\def\psk@ThreeDplot@zMin{#1}} -\define@key[psset]{pst-3dplot}{zMax}{\def\psk@ThreeDplot@zMax{#1}} -\define@key[psset]{pst-3dplot}{xThreeDunit}{\def\psk@ThreeDplot@xThreeDunit{#1}} -\define@key[psset]{pst-3dplot}{yThreeDunit}{\def\psk@ThreeDplot@yThreeDunit{#1}} -\define@key[psset]{pst-3dplot}{zThreeDunit}{\def\psk@ThreeDplot@zThreeDunit{#1}} -\define@key[psset]{pst-3dplot}{deltax}{\def\psk@ThreeDplot@deltax{#1}} -\define@key[psset]{pst-3dplot}{deltay}{\def\psk@ThreeDplot@deltay{#1}} -\define@key[psset]{pst-3dplot}{deltaz}{\def\psk@ThreeDplot@deltaz{#1}} -\define@key[psset]{pst-3dplot}{Deltax}{\def\psk@ThreeDplot@Deltax{#1}} -\define@key[psset]{pst-3dplot}{Deltay}{\def\psk@ThreeDplot@Deltay{#1}} -\define@key[psset]{pst-3dplot}{Deltaz}{\def\psk@ThreeDplot@Deltaz{#1}} +\define@key[psset]{pst-3dplot}{xMin}{\pst@checknum{#1}\psk@ThreeDplot@xMin } +\define@key[psset]{pst-3dplot}{xMax}{\pst@checknum{#1}\psk@ThreeDplot@xMax } +\define@key[psset]{pst-3dplot}{yMin}{\pst@checknum{#1}\psk@ThreeDplot@yMin } +\define@key[psset]{pst-3dplot}{yMax}{\pst@checknum{#1}\psk@ThreeDplot@yMax } +\define@key[psset]{pst-3dplot}{zMin}{\pst@checknum{#1}\psk@ThreeDplot@zMin } +\define@key[psset]{pst-3dplot}{zMax}{\pst@checknum{#1}\psk@ThreeDplot@zMax } +\define@key[psset]{pst-3dplot}{xThreeDunit}{\pst@checknum{#1}\psk@ThreeDplot@xThreeDunit } +\define@key[psset]{pst-3dplot}{yThreeDunit}{\pst@checknum{#1}\psk@ThreeDplot@yThreeDunit } +\define@key[psset]{pst-3dplot}{zThreeDunit}{\pst@checknum{#1}\psk@ThreeDplot@zThreeDunit } +\define@key[psset]{pst-3dplot}{deltax}{\pst@checknum{#1}\psk@ThreeDplot@deltax } +\define@key[psset]{pst-3dplot}{deltay}{\pst@checknum{#1}\psk@ThreeDplot@deltay } +\define@key[psset]{pst-3dplot}{deltaz}{\pst@checknum{#1}\psk@ThreeDplot@deltaz } +\define@key[psset]{pst-3dplot}{Deltax}{\pst@checknum{#1}\psk@ThreeDplot@Deltax } +\define@key[psset]{pst-3dplot}{Deltay}{\pst@checknum{#1}\psk@ThreeDplot@Deltay } +\define@key[psset]{pst-3dplot}{Deltaz}{\pst@checknum{#1}\psk@ThreeDplot@Deltaz } % % -------------- the angles and the plotpoints ------------- % -\define@key[psset]{pst-3dplot}{Alpha}{\def\psk@ThreeDplot@Alpha{#1}} % Horizontal turn -\define@key[psset]{pst-3dplot}{Beta}{\def\psk@ThreeDplot@Beta{#1}}% Vertical turn -\define@key[psset]{pst-3dplot}{RotX}{\def\psk@ThreeD@RotX{#1}}% x rotation -\define@key[psset]{pst-3dplot}{RotY}{\def\psk@ThreeD@RotY{#1}}% y rotation -\define@key[psset]{pst-3dplot}{RotZ}{\def\psk@ThreeD@RotZ{#1}}% z -\define@key[psset]{pst-3dplot}{RotSequence}{\def\psk@ThreeD@RotS{#1}}% -\define@key[psset]{pst-3dplot}{PlaneSequence}{\def\psk@ThreeD@PlaneSequence{#1}}% -\define@key[psset]{pst-3dplot}{zCoor}{\def\psk@ThreeDplot@zCoor{#1}} +\define@key[psset]{pst-3dplot}{Alpha}{\pst@getangle{#1}\psk@ThreeDplot@Alpha } % Horizontal turn +\define@key[psset]{pst-3dplot}{Beta}{\pst@getangle{#1}\psk@ThreeDplot@Beta }% Vertical turn +\define@key[psset]{pst-3dplot}{RotX}{\pst@getangle{#1}\psk@ThreeD@RotX }% x rotation +\define@key[psset]{pst-3dplot}{RotY}{\pst@getangle{#1}\psk@ThreeD@RotY }% y rotation +\define@key[psset]{pst-3dplot}{RotZ}{\pst@getangle{#1}\psk@ThreeD@RotZ }% z +\define@key[psset]{pst-3dplot}{RotSequence}{\def\psk@ThreeD@RotS{#1 }}% +\define@key[psset]{pst-3dplot}{PlaneSequence}{\def\psk@ThreeD@PlaneSequence{#1 }}% +\define@key[psset]{pst-3dplot}{zCoor}{\pst@checknum{#1}\psk@ThreeDplot@zCoor } \psset[pst-3dplot]{zCoor=0} % \def\drawStyle@xLines{xLines}% 0 @@ -190,6 +190,11 @@ % \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 @@ -342,9 +347,9 @@ % \ifnum\psk@ThreeDplot@Alpha=90\else \pst@dimx=\psk@ThreeDplot@xMax\p@% \pst@dima=\psk@ThreeDplot@xThreeDunit\p@% - \pst@dima=\psk@ThreeDplot@deltax\pst@dima - \pst@dima=\pst@dima - \divide\pst@dimx by \pst@dima + \pst@dima=\psk@ThreeDplot@deltax\pst@dima% +% \pst@dima=\pst@dima + \divide\pst@dimx by \pst@dima% \pst@cntx=\number\pst@dimx\advance\pst@cntx by -1% \multido{% % \rA=\psk@ThreeDplot@Deltax+\psk@ThreeDplot@Deltax,% the label increment @@ -358,9 +363,8 @@ \pst@dimx=\psk@ThreeDplot@xMin\p@% \pst@dima=\psk@ThreeDplot@xThreeDunit\p@% \divide\pst@dimx by \pst@dima% - \ifnum\psk@ThreeDplot@xMin<\z@\pst@cntx=-\number\pst@dimx% - \else\pst@cntx=\number\pst@dimx% - \fi% + \ifdim\psk@ThreeDplot@xMin pt<\p@ \pst@cntx=-\number\pst@dimx% + \else\pst@cntx=\number\pst@dimx\fi% \multido{\rA=-\psk@Dx+-\psk@Dx,% \rB=-\psk@ThreeDplot@xThreeDunit+-\psk@ThreeDplot@xThreeDunit}{\pst@cntx}{% \pstThreeDLine[arrows=-](\rB,-\psk@IIIDticksize,0)(\rB,\psk@IIIDticksize,0)% @@ -370,6 +374,7 @@ % \ifnum\psk@ThreeDplot@Alpha=0\else \pst@dimy=\psk@ThreeDplot@yMax\p@% \pst@dima=\psk@ThreeDplot@yThreeDunit\p@% + \pst@dima=\psk@ThreeDplot@deltay\pst@dima% \divide\pst@dimy by \pst@dima% \pst@cnty=\number\pst@dimy\advance\pst@cnty by -1% \mmultido{\rA=0.0+\psk@Dy,\rB=0.0+\psk@ThreeDplot@yThreeDunit}{\pst@cnty}{% @@ -379,7 +384,7 @@ \pst@dimy=\psk@ThreeDplot@yMin\p@% \pst@dima=\psk@ThreeDplot@yThreeDunit\p@% \divide\pst@dimy by \pst@dima% - \ifnum\psk@ThreeDplot@yMin<\z@\pst@cnty=-\number\pst@dimy% + \ifdim\psk@ThreeDplot@yMin pt<\p@ \pst@cnty=-\number\pst@dimy% \else\pst@cnty=\number\pst@dimy% \fi% \multido{\rA=-\psk@Dy+-\psk@Dy,% @@ -398,8 +403,9 @@ }% \pst@dimz=\psk@ThreeDplot@zMin\p@% \pst@dima=\psk@ThreeDplot@zThreeDunit\p@% + \pst@dima=\psk@ThreeDplot@deltaz\pst@dima% \divide\pst@dimz by \pst@dima% - \ifnum\psk@ThreeDplot@zMin<\z@\pst@cntz=-\number\pst@dimz% + \ifdim\psk@ThreeDplot@zMin pt<\p@ \pst@cntz=-\number\pst@dimz% \else\pst@cntz=\number\pst@dimz% \fi% \multido{\rA=-\psk@Dz+-\psk@Dz,% @@ -517,30 +523,30 @@ \pst@cp\space \psline@iii\space \tx@Line }% \end@OpenObj% + \ignorespaces% \SpecialCoor% - \ignorespaces } % % set a 3d dot % -\def\pstThreeDDot{\pst@object{pst@ThreeDDot}} -\def\pst@ThreeDDot@i(#1,#2,#3){% - \addbefore@par{linestyle=dashed,linewidth=0.5pt}% default -% \typeout{\pst@par} +\def\pstThreeDDot{\pst@object{pstThreeDDot}} +\def\pstThreeDDot@i(#1,#2,#3){% + \def\pst@tempThreeDDot{#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% + \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 \variablesIIID - \ifPst@SphericalCoor - #1\space #2\space #3\space - ConvertToCartesian + \pst@tempThreeDDot + \ifPst@SphericalCoor + 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 + \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 @@ -580,22 +586,63 @@ % transform the 3d coordinates of the node (#1,#2,#3) % into a 2d node with the name #4 % -\def\pstThreeDNode{\@ifnextchar[{\pst@ThreeDNode}{\pst@ThreeDNode[]}} -\def\pst@ThreeDNode[#1](#2,#3,#4)#5{{% - \psset{#1}% - \pnode(!% +\def\pstThreeDNode{\pst@object{pstThreeDNode}} +\def\pstThreeDNode@i(#1,#2,#3)#4{% + \begin@SpecialObj% + \def\pst@tempThreeDNode{#1 #2 #3 }% + \pnode(! \pst@3ddict \variablesIIID - \ifPst@SphericalCoor - #2\space #3\space #4\space - ConvertToCartesian + \pst@tempThreeDNode + \ifPst@SphericalCoor + 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} + \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{\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 + \variablesIIID +% #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[](){} % @@ -621,12 +668,46 @@ %\def\pstThreeDTriangle{\@ifnextchar[{\do@ThreeDTriangle}{\do@ThreeDTriangle[]}} \def\pstThreeDTriangle{\pst@object{pst@ThreeDTriangle}} \def\pst@ThreeDTriangle@i(#1)(#2)(#3){% - \begin@SpecialObj + \begingroup + \use@par \ifPst@drawCoor% - \pstThreeDDot[drawCoor=true](#1) - \pstThreeDDot[drawCoor=true](#2) - \pstThreeDDot[drawCoor=true](#3) + \bgroup + \pstThreeDDot[style=showCoorStyle](#1) + \pstThreeDDot[style=showCoorStyle](#2) + \pstThreeDDot[style=showCoorStyle](#3) + \egroup \fi% + \getThreeDCoor{#1}\pst@tempAA + \getThreeDCoor{#2}\pst@tempBB + \getThreeDCoor{#3}\pst@tempCC + \begin@ClosedObj + \addto@pscode{% + \pst@3ddict + \variablesIIID + /P1 { \pst@tempAA } def % x y z or Radius longitude lattitude + /P2 { \pst@tempBB } def % + /P3 { \pst@tempCC } 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% +\iffalse \pstThreeDNode(#1){A} \pstThreeDNode(#2){B} \pstThreeDNode(#3){C} @@ -635,6 +716,8 @@ \psline(A)(B)(C)(A)(B)% \ifx\psk@fillstyle\@none\else}\fi% \end@SpecialObj +\fi + \endgroup \ignorespaces} % % draws a threeD square as a polygon @@ -647,15 +730,14 @@ \def\pstThreeDSquare{\pst@object{pstThreeDSquare}} \def\pstThreeDSquare@i(#1)(#2)(#3){% \ifPst@drawCoor {% - \psset{linestyle=dashed,linewidth=0.5pt}% - \pstThreeDDot(#1)% - \pst@addThreeDVec(#1)(#2)\pst@tempA\pst@tempB\pst@tempC% - \pstThreeDDot(\pst@tempA,\pst@tempB,\pst@tempC)% - \pst@addThreeDVec(#1)(#3)\pst@tempA\pst@tempB\pst@tempC - \pstThreeDDot(\pst@tempA,\pst@tempB,\pst@tempC)% - \pst@addThreeDVec(\pst@tempA,\pst@tempB,\pst@tempC)% - (#2)\pst@tempA\pst@tempB\pst@tempC% - \pstThreeDDot(\pst@tempA,\pst@tempB,\pst@tempC)% + \pstThreeDDot[style=showCoorStyle](#1)% + \pst@addThreeDVec(#1)(#2)\pst@tempAA\pst@tempBB\pst@tempCC + \pstThreeDDot[style=showCoorStyle](\pst@tempAA,\pst@tempBB,\pst@tempCC)% + \pst@addThreeDVec(#1)(#3)\pst@tempAA\pst@tempBB\pst@tempCC + \pstThreeDDot[style=showCoorStyle](\pst@tempAA,\pst@tempBB,\pst@tempCC)% + \pst@addThreeDVec(\pst@tempAA,\pst@tempBB,\pst@tempCC)% + (#2)\pst@tempAA\pst@tempBB\pst@tempCC + \pstThreeDDot[style=showCoorStyle](\pst@tempAA,\pst@tempBB,\pst@tempCC)% }% \fi \getThreeDCoor{#1}\pst@tempAA @@ -848,7 +930,7 @@ [ 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 }% + \pst@cp\space \psline@iii\space \tx@Line\space end }% \end@OpenObj% }\ignorespaces} % @@ -889,9 +971,17 @@ /increment \psk@ThreeDplot@increment\space def /viewpoint { \psk@viewpoint - \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 + \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 + \or + 3 1 roll 45 cos add 3 1 roll 45 sin add 3 1 roll + \fi } def 0 viewpoint 0 \tx@SetMatrixThreeD viewpoint @@ -906,9 +996,13 @@ % /calculate2DPoint { % four values on stack; x2D y2D are returned /V0 ED /Z0 ED /U20 ED /U10 ED - U10 cos V0 mul radius mul #1 add \pst@number\psunit mul - U20 sin V0 mul radius mul #2 add \pst@number\psunit mul - Z0 #3 add \pst@number\psunit mul \tx@ProjThreeD + U10 cos V0 mul radius mul #1 add + U20 sin V0 mul radius mul #2 add + Z0 #3 add %\tx@ProjThreeD + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def /condition { PSfacetteParaboloid 0 le } def true MaillageParaboloid @@ -937,23 +1031,28 @@ \addto@pscode{% /viewpoint {% to make it compatible with parallel projection \psk@viewpoint - \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 + \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 + \or + 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 x y zLight +% 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 -% \psk@ThreeDplot@xyzLight\space % xLight yLight zLight - tx@3DPlotDict begin - \variablesIIID - MaillageSphere end + tx@3DPlotDict begin \variablesIIID MaillageSphere end }% fin du code ps \showpointsfalse% \end@SpecialObj% @@ -1031,9 +1130,17 @@ \addto@pscode { /viewpoint { \psk@viewpoint - \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 + \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 + \or + 3 1 roll 45 cos add 3 1 roll 45 sin add 3 1 roll + \fi } def 0 viewpoint 0 \tx@SetMatrixThreeD viewpoint @@ -1079,18 +1186,23 @@ \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{#5} -\begin@SpecialObj% -\use@par -\addto@pscode { + \addto@par{viewpoint=0 0 0}% + \pssetlength\pst@dima{#4}\pssetlength\pst@dimb{#5}\pssetlength\pst@dimc{#5} + \begin@SpecialObj% + \addto@pscode { /viewpoint { \psk@viewpoint - \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 + \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 + \or + 3 1 roll 45 cos add 3 1 roll 45 sin add 3 1 roll + \fi } def 0 viewpoint 0 \tx@SetMatrixThreeD viewpoint @@ -1151,9 +1263,6 @@ \fi% }\ignorespaces} % -%\def\doPlotThreeD@xLines{\pst@object{psplotThreeD@xLines}} -%\def\doPlotThreeD@yLines{\pst@object{psplotThreeD@yLines}} -% \def\psplotThreeD@xLines(#1,#2)(#3,#4)#5{% \pst@killglue% \begingroup% @@ -1173,13 +1282,13 @@ /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 /func {#5} def - /xyz { - x neg Alpha cos mul - \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse Alpha sin mul add \pst@number\psxunit mul - x Alpha sin mul - \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse Alpha cos mul add neg Beta sin mul + /xyz { + x \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse \psk@ThreeDplot@zCoor\space 0 gt { \psk@ThreeDplot@zCoor }{ func } ifelse - Beta cos mul add \pst@number\psyunit mul} def + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def }% \psplotThreeD@xLines@ii \else% curves @@ -1196,16 +1305,13 @@ /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 /func {#5} def - /xyz { - x neg Alpha cos mul - \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse Alpha sin mul add \pst@number\psxunit mul - x Alpha sin mul - \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse Alpha cos mul add neg Beta sin mul + /xyz { + x \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse \psk@ThreeDplot@zCoor\space 0 gt { \psk@ThreeDplot@zCoor }{ func } ifelse - Beta cos mul add \pst@number\psyunit mul} def -% x neg Alpha cos mul y Alpha sin mul add \pst@number\psxunit mul -% x Alpha sin mul y Alpha cos mul add neg Beta sin mul -% func Beta cos mul add \pst@number\psyunit mul} def + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def }% \psplotThreeD@xLines@iii% \ifPst@hiddenLine }\fi% @@ -1270,16 +1376,13 @@ /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 /func {#5} def - /xyz { - x neg Alpha cos mul - \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse Alpha sin mul add \pst@number\psxunit mul - x Alpha sin mul - \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse Alpha cos mul add neg Beta sin mul + /xyz { + x \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse \psk@ThreeDplot@zCoor\space 0 gt { \psk@ThreeDplot@zCoor }{ func } ifelse - Beta cos mul add \pst@number\psyunit mul} def -% x neg Alpha cos mul y Alpha sin mul add \pst@number\psxunit mul -% x Alpha sin mul y Alpha cos mul add neg Beta sin mul -% func Beta cos mul add \pst@number\psyunit mul} def + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def }% \psplotThreeD@yLines@ii \else% curves @@ -1295,17 +1398,14 @@ /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 - /func {#5} def - /xyz { - x neg Alpha cos mul - \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse Alpha sin mul add \pst@number\psxunit mul - x Alpha sin mul - \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse Alpha cos mul add neg Beta sin mul + /func { #5 } def % func=f(x,y) + /xyz { + x \psk@ThreeDplot@zCoor\space 0 gt { func }{ y } ifelse \psk@ThreeDplot@zCoor\space 0 gt { \psk@ThreeDplot@zCoor }{ func } ifelse - Beta cos mul add \pst@number\psyunit mul} def -% x neg Alpha cos mul y Alpha sin mul add \pst@number\psxunit mul -% x Alpha sin mul y Alpha cos mul add neg Beta sin mul -% func Beta cos mul add \pst@number\psyunit mul} def + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def }% \psplotThreeD@yLines@iii% \ifPst@hiddenLine }\fi% @@ -1362,26 +1462,6 @@ \@pstfalse% \@nameuse{beginplot@\psplotstyle}% \@nameuse{testqp@\psplotstyle}% quick plot or something special - \pstVerb{% - /3D2DConv { - 3 -1 roll % y z x - \psk@ThreeDplot@xThreeDunit\space mul - dup % y z x x - neg Alpha cos mul % y z x (x) - 4 -1 roll % z x (x) y - \psk@ThreeDplot@yThreeDunit\space mul - dup % z x (x) y y - 5 1 roll % y z x (x) y - Alpha sin mul add \pst@number\psxunit mul % y z x (x2) - 4 1 roll % (x2) y z x - Alpha sin mul % (x2) y z (x) - 3 -1 roll % (x2) z (x) y - Alpha cos mul add neg Beta sin mul % (x2) z (x) - exch % (x2) (x) z - \psk@ThreeDplot@zThreeDunit\space mul - Beta cos mul add \pst@number\psyunit mul % (x2) (y2) - } def - }% \if@pst% \def\pslinetype{0}% \addto@pscode{% @@ -1395,7 +1475,11 @@ { 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 { #5 3D2DConv } def + /xyz { #5 + tx@3DPlotDict begin + saveCoor + ConvertTo2D + x2D \pst@number\psxunit mul y2D \pst@number\psyunit mul end } def }% \parametricPlotThreeD@iii% \else% @@ -1416,12 +1500,17 @@ /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 { #5 3D2DConv } def + /xyz { #5 + 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\space { @@ -1436,6 +1525,7 @@ }% \@nameuse{endqp@\psplotstyle}% } +% \def\parametricPlotThreeD@iv{% with arrows or curve \addto@pscode{% % /t tMin def @@ -1497,22 +1587,11 @@ /Dx { /D { Dy } def } def /Dy { /D { Dz } def } def /Dz { % now we have x y z - 3 -1 roll % y z x - \psk@ThreeDplot@xThreeDunit\space div - dup % y z x x - neg Alpha cos mul % y z x (x) - 4 -1 roll % z x (x) y - \psk@ThreeDplot@yThreeDunit\space div - dup % z x (x) y y - 5 1 roll % y z x (x) y - Alpha sin mul add \pst@number\psxunit mul % y z x (x2) - 4 1 roll % (x2) y z x - Alpha sin mul % (x2) y z (x) - 3 -1 roll % (x2) z (x) y - Alpha cos mul add neg Beta sin mul % (x2) z (x) - exch % (x2) (x) z - \psk@ThreeDplot@zThreeDunit\space div - Beta cos mul add \pst@number\psyunit mul % (x2) (y2) + 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 { @@ -1529,22 +1608,11 @@ 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 - 3 -1 roll % y z x - \psk@ThreeDplot@xThreeDunit\space div - dup % y z x x - neg Alpha cos mul % y z x (x) - 4 -1 roll % z x (x) y - \psk@ThreeDplot@yThreeDunit\space div - dup % z x (x) y y - 5 1 roll % y z x (x) y - Alpha sin mul add \pst@number\psxunit mul % y z x (x2) - 4 1 roll % (x2) y z x - Alpha sin mul % (x2) y z (x) - 3 -1 roll % (x2) z (x) y - Alpha cos mul add neg Beta sin mul % (x2) z (x) - exch % (x2) (x) z - \psk@ThreeDplot@zThreeDunit\space div - Beta cos mul add \pst@number\psyunit mul % (x2) (y2) + 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 -- cgit v1.2.3