summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-3dplot
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-06-17 21:35:47 +0000
committerKarl Berry <karl@freefriends.org>2007-06-17 21:35:47 +0000
commitc4ae47344ef52c976c8de09bd07d290cd2bb983f (patch)
tree2297cae4f0b28585c24c372846dd41da10950d63 /Master/texmf-dist/tex/generic/pst-3dplot
parent47e22c8c21f92ffb4d94e0bcf8785980d52dbbe0 (diff)
pst-3dplot update (17jun07)
git-svn-id: svn://tug.org/texlive/trunk@4450 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-3dplot')
-rw-r--r--Master/texmf-dist/tex/generic/pst-3dplot/pst-3dplot.tex207
1 files changed, 143 insertions, 64 deletions
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 e8812bd5102..88063d0edd8 100644
--- a/Master/texmf-dist/tex/generic/pst-3dplot/pst-3dplot.tex
+++ b/Master/texmf-dist/tex/generic/pst-3dplot/pst-3dplot.tex
@@ -22,11 +22,11 @@
\ifx\PSTnodesLoaded\endinput\else\input pst-3d.tex\fi
\ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi
\ifx\PSTplotLoaded\endinput\else\input pst-plot.tex\fi% plotpoints
-%\ifx\PSTVueTroisDLoaded\endinput\else\input pst-vue3d.tex\fi
+\ifx\PSTricksAddLoaded\endinput\else\input pstricks-add.tex\fi
\ifx\PSTMultidoLoaded\endinput\else\input multido.tex\fi
%
-\def\fileversion{1.72}
-\def\filedate{2006/02/07}
+\def\fileversion{1.74}
+\def\filedate{2007/06/17}
\message{`PST-3dplot' v\fileversion, \filedate\space (HV)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
@@ -60,18 +60,15 @@
%
% ---------------- the if's -----------------
%
-\newif\ifPst@drawing% draw the coordinates?
-\define@key[psset]{pst-3dplot}{drawing}[true]{\@nameuse{Pst@drawing#1}}
-\newif\ifPst@drawCoor% draw the coordinates of a dot?
-\define@key[psset]{pst-3dplot}{drawCoor}[true]{\@nameuse{Pst@drawCoor#1}}
-\newif\ifPst@hiddenLine% emulate hidden line surface?
-\define@key[psset]{pst-3dplot}{hiddenLine}[true]{\@nameuse{Pst@hiddenLine#1}}
-\newif\ifPst@SphericalCoor% (r,phi,theta)
-\define@key[psset]{pst-3dplot}{SphericalCoor}[true]{\@nameuse{Pst@SphericalCoor#1}}
-\psset[pst-3dplot]{SphericalCoor=false}
-\newif\ifPst@leftHanded% left-Handed coor?
-\define@key[psset]{pst-3dplot}{leftHanded}[true]{\@nameuse{Pst@leftHanded#1}}
-\psset[pst-3dplot]{leftHanded=false}
+\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)
+ \Pst@CylindricalCoorfalse}%
+\define@boolkey[psset]{pst-3dplot}[Pst@]{CylindricalCoor}[true]{% (r,phi,z)
+ \Pst@SphericalCoorfalse}%
+\define@boolkey[psset]{pst-3dplot}[Pst@]{leftHanded}[true]{}% left-Handed coor
+\psset[pst-3dplot]{drawing,drawCoor,hiddenLine=false,SphericalCoor=false,leftHanded=false}
%
% ------- the global definitions for the pspicture frame ------
%
@@ -127,9 +124,10 @@
\define@key[psset]{pst-3dplot}{linejoin}{% how lines come together 0,1,2
\def\psk@ThreeDplot@linejoin{#1}}
\define@key[psset]{pst-3dplot}{plane}{% xy,xz,yz
- \def\psk@ThreeDplot@plane{#1}}
-\define@key[psset]{pst-3dplot}{pOrigin}{% combination of (lr)(tBb)
+ \edef\psk@ThreeDplot@plane{#1}} % must be expanded
+\define@key[psset]{pst-3dplot}{pOrigin}{% combination of (lr)(tBb)
\def\psk@ThreeDplot@pOrigin{#1}}
+\define@key[psset]{pst-3dplot}{IIIDdAlpha}{\def\psk@IIIDdAlpha{#1 }}
\def\ThreeDplot@planeXY{xy}
\def\ThreeDplot@planeXZ{xz}
\def\ThreeDplot@planeYZ{yz}
@@ -149,9 +147,9 @@
\define@key[psset]{pst-3dplot}{arrowOffset}{% offset for \arrowLine
\def\psk@ThreeDplot@arrowOffset{#1}}
\define@key[psset]{pst-3dplot}{visibleLineStyle}{% offset for \arrowLine
- \def\psk@ThreeDplot@visibleLineStyle{#1}}
+ \edef\psk@ThreeDplot@visibleLineStyle{#1}}
\define@key[psset]{pst-3dplot}{invisibleLineStyle}{% offset for \arrowLine
- \def\psk@ThreeDplot@invisibleLineStyle{#1}}
+ \edef\psk@ThreeDplot@invisibleLineStyle{#1}}
%
\newif\if@IIIDticks% draw the ticks?
\define@key[psset]{pst-3dplot}{IIIDticks}[true]{\@nameuse{@IIIDticks#1}}
@@ -212,26 +210,29 @@
\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\setDefaults{%
+%
+\def\setIIIDplotDefaults{%
\psset[pst-3dplot]{%
- drawing=true,hiddenLine=false,xMin=-1,xMax=4,yMin=-1,yMax=4,zMin=-1,zMax=4,%
- xThreeDunit=1.0,yThreeDunit=1.0,zThreeDunit=1.0,Alpha=45,Beta=30,%
- deltax=1,deltay=1,deltaz=1,Deltax=1,Deltay=1,Deltaz=1,%
- RotX=0,RotY=0,RotZ=0,RotSequence=xyz,%
- drawStyle=xLines,xPlotpoints=25,yPlotpoints=25,beginAngle=0,endAngle=360,%
- linejoin=1,XO=0,YO=0,angleStep=1,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,SphericalCoor=false,%
- Dz=1,IIIDticks=false,IIIDxTicksPlane=xy,IIIDyTicksPlane=yz,IIIDzTicksPlane=yz,%
+ drawing=true,hiddenLine=false,xMin=-1,xMax=4,yMin=-1,yMax=4,zMin=-1,zMax=4,
+ xThreeDunit=1.0,yThreeDunit=1.0,zThreeDunit=1.0,Alpha=45,Beta=30,
+ deltax=1,deltay=1,deltaz=1,Deltax=1,Deltay=1,Deltaz=1,
+ RotX=0,RotY=0,RotZ=0,RotSequence=xyz,
+ drawStyle=xLines,xPlotpoints=25,yPlotpoints=25,beginAngle=0,endAngle=360,
+ linejoin=1,XO=0,YO=0,angleStep=1,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,IIIDxTicksPlane=xy,IIIDyTicksPlane=yz,IIIDzTicksPlane=yz,
IIIDticksize=0.1,IIIDxticksep=-0.4,IIIDyticksep=-0.2,IIIDzticksep=0.2,
- planecorr=off,%
+ planecorr=off,
planeGrid=xy,planeGridOffset=0,subticks=10,
- leftHanded=false%
+ leftHanded=false,IIIDdAlpha=0
}%
\def\pst@linetype{2}% to prevent an unknown linetyp with dash
}
-\setDefaults
+\setIIIDplotDefaults
%
\def\variablesIIID{
% 0 0 translate
@@ -509,8 +510,8 @@
\addbefore@par{linestyle=dashed,linewidth=0.5pt}% default
% \typeout{\pst@par}
\begin@SpecialObj
- \pstThreeDNode(#1,#2,#3){A}% we need the parameters
- \ifx\psk@dotstyle\@none\else\psdots(A)\fi%
+ \pstThreeDNode(#1,#2,#3){pst@A}% we need the parameters
+ \ifx\psk@dotstyle\@none\else\psdots(pst@A)\fi%
\ifPst@drawCoor%
\addto@pscode{
\pst@3ddict
@@ -599,25 +600,24 @@
%
% Trangle [options](Point1)(Point2)(Point3)
%
-\def\pstThreeDTriangle{\@ifnextchar[{\do@ThreeDTriangle}{\do@ThreeDTriangle[]}}
-\def\do@ThreeDTriangle[#1](#2)(#3)(#4){{%
- \ifx#1\empty\else\psset{#1}\fi%
+%\def\pstThreeDTriangle{\@ifnextchar[{\do@ThreeDTriangle}{\do@ThreeDTriangle[]}}
+\def\pstThreeDTriangle{\pst@object{pst@ThreeDTriangle}}
+\def\pst@ThreeDTriangle@i(#1)(#2)(#3){%
+ \begin@SpecialObj
\ifPst@drawCoor%
- \pstThreeDDot[drawCoor=true](#2)%
- \pstThreeDDot[drawCoor=true](#3)%
- \pstThreeDDot[drawCoor=true](#4)%
+ \pstThreeDDot[drawCoor=true](#1)
+ \pstThreeDDot[drawCoor=true](#2)
+ \pstThreeDDot[drawCoor=true](#3)
\fi%
- \pstThreeDNode(#2){A}%
- \pstThreeDNode(#3){B}%
- \pstThreeDNode(#4){C}%
+ \pstThreeDNode(#1){A}
+ \pstThreeDNode(#2){B}
+ \pstThreeDNode(#3){C}
\ifx\psk@fillstyle\@none%
- \else%
- \pscustom{%
- \code{\psk@ThreeDplot@linejoin\space setlinejoin}%
- \fi%
- \psline[#1](A)(B)(C)(A)(B)%
+ \else\pscustom{\code{\psk@ThreeDplot@linejoin\space setlinejoin}\fi%
+ \psline(A)(B)(C)(A)(B)%
\ifx\psk@fillstyle\@none\else}\fi%
-}\ignorespaces}
+ \end@SpecialObj
+ \ignorespaces}
%
% draws a threeD square as a polygon
%
@@ -672,7 +672,7 @@
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
+ \pst@cp\space \psline@iii\space \tx@Line\space closepath
end
}%
\end@OpenObj%
@@ -691,11 +691,8 @@
\begingroup%
\psset{linestyle=\psk@ThreeDplot@invisibleLineStyle}%
\psset{#1}%
- \pstVerb{
- \pst@3ddict
- \variablesIIID
- end
- }%
+ \pstVerb{ \pst@3ddict \variablesIIID end }%
+\iftrue
\pstThreeDSquare[#1](#2)(#4)(#5) % lower square
\pstThreeDSquare(#2)(#3)(#4)% back square
%
@@ -706,6 +703,28 @@
\pstThreeDSquare[#1](\pst@tempa,\pst@tempb,\pst@tempc)(#4)(#5)% top square
\pst@addThreeDVec(#2)(#5)\pst@tempa\pst@tempb\pst@tempc
\pstThreeDSquare[#1](\pst@tempa,\pst@tempb,\pst@tempc)(#3)(#4)% front square
+\else% better support for hidden lines
+ \pstThreeDSquare[#1](#2)(#4)(#5) % lower square
+ \pst@absdim{\psk@ThreeDplot@Alpha pt}\pst@dimo
+ \ifdim\pst@dimo<90pt \ifdim\pst@dimo>270pt
+ \pstThreeDSquare(#2)(#3)(#4)% back square
+ \else
+ \pst@addThreeDVec(#2)(#5)\pst@tempA\pst@tempB\pst@tempC
+ \pstThreeDSquare[#1](\pst@tempA,\pst@tempB,\pst@tempC)(#3)(#4)% front square
+ \fi\fi
+%
+ \psset{linestyle=\psk@ThreeDplot@visibleLineStyle}%
+ \pst@addThreeDVec(#2)(#4)\pst@tempA\pst@tempB\pst@tempC
+ \pstThreeDSquare[#1](\pst@tempA,\pst@tempB,\pst@tempC)(#3)(#5)% left square
+ \pst@addThreeDVec(#2)(#3)\pst@tempA\pst@tempB\pst@tempC
+ \pstThreeDSquare[#1](\pst@tempA,\pst@tempB,\pst@tempC)(#4)(#5)% top square
+ \ifdim\pst@dimo<90pt \ifdim\pst@dimo>270pt
+ \pst@addThreeDVec(#2)(#5)\pst@tempA\pst@tempB\pst@tempC
+ \pstThreeDSquare[#1](\pst@tempA,\pst@tempB,\pst@tempC)(#3)(#4)% front square
+ \else
+ \pstThreeDSquare(#2)(#3)(#4)% back square
+ \fi\fi
+\fi
\endgroup%
\ignorespaces%
}
@@ -844,10 +863,12 @@
\newif\ifPstThreeDplot@showInside
\define@key[psset]{pst-3dplot}{showInside}[true]{\@nameuse{PstThreeDplot@showInside@#1}}
\define@key[psset]{pst-3dplot}{SegmentColor}{\pst@getcolor{#1}\psk@ThreeDplot@SegmentColor}
-\define@key[psset]{pst-3dplot}{increment}{\pst@getint{#1}\psk@ThreeDplot@increment}
+\define@key[psset]{pst-3dplot}{increment}{\pst@checknum{#1}\psk@ThreeDplot@increment}
%\define@key[psset]{pst-3dplot}{CMYK}{\def\psk@ThreeDplot@CMYK{#1}}
\define@key[psset]{pst-3dplot}{xyzLight}{\def\psk@ThreeDplot@xyzLight{#1}}
-\psset[pst-3dplot]{xyzLight=1 1 2,showInside=true,SegmentColor={[cmyk]{0.2,0.6,1,0}},increment=10}
+\newcmykcolor{SegColor}{0.2 0.6 1 0}
+\psset[pst-3dplot]{xyzLight=1 1 2,showInside=true,SegmentColor=SegColor,increment=10}
+%\psset[pst-3dplot]{xyzLight=1 1 2,showInside=true,SegmentColor={[cmyk]{0.2,0.6,1,0}},increment=10}
%
\def\pstParaboloid{\pst@object{pstParaboloid}}
\def\pstParaboloid@i#1#2{% #1:height #2:radius
@@ -867,11 +888,11 @@
0 viewpoint 0 \tx@SetMatrixThreeD
viewpoint /vZ ED /vY ED /vX ED
1 setlinejoin
- % les rayons de lumière
+ % les rayons de lumière
/xLight 1 def
/yLight 0.1 def
/zLight 0.2 def
- % précision du tracé
+ % précision du tracè
/pas 0.5 def
/pas10 {pas 10 div} bind def
%
@@ -888,7 +909,7 @@
/V {Z sqrt} bind def
/TableauxPoints [
0 1 359 {
- /U exch def [ U U Z V caclculate2DPoint ] % on décrit le cercle
+ /U exch def [ U U Z V calculate2DPoint ] % on décrit le cercle
} for
] def
newpath
@@ -943,7 +964,7 @@
nZfacette dup mul
add add sqrt} bind def
NormeN 0 eq {/NormeN 1e-10 def} if
-% test de visibilité
+% test de visibilité
/PSfacette vX nXfacette mul
vY nYfacette mul add
vZ nZfacette mul add def
@@ -985,8 +1006,7 @@
\end@SpecialObj%
\ignorespaces}
%
-% Sphere
-% the new one
+% Sphere, the new one
\def\pstThreeDSphere{\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
@@ -1015,6 +1035,65 @@
\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{%
+ \pst@3ddict \variablesIIID end
+ /POrig {
+ #1 #2 #3 \ifPst@CylindricalCoor \tx@ConvCylToCartesian \fi
+ \pst@number\psunit mul 3 1 roll
+ \pst@number\psunit mul 3 1 roll
+ \pst@number\psunit mul 3 1 roll } def
+ tx@3DPlotDict begin
+ POrig Conv3D2D translate
+ #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
+ \addto@pscode{%
+ \pst@3ddict \variablesIIID end
+ /POrig {
+ #1 #2 #3 \ifPst@CylindricalCoor \tx@ConvCylToCartesian \fi
+ \pst@number\psunit mul 3 1 roll
+ \pst@number\psunit mul 3 1 roll
+ \pst@number\psunit mul 3 1 roll } def
+ tx@3DPlotDict begin
+ POrig Conv3D2D translate
+ #4 \pst@number\psunit mul % radius
+ #5 \pst@number\psunit mul % height
+ 0 360 % for the future
+ \psk@ThreeDplot@increment
+ false % wedge?
+ IIIDCylinder
+ end
+ }% end of pscode
+ \end@SpecialObj
+ \let\pst@par\pst@parOrig
+ \begin@ClosedObj
+ \addto@pscode{%
+ \pst@3ddict \variablesIIID end
+ /POrig {
+ #1 #2 #3 #5 add \ifPst@CylindricalCoor \tx@ConvCylToCartesian \fi
+ \pst@number\psunit mul 3 1 roll
+ \pst@number\psunit mul 3 1 roll
+ \pst@number\psunit mul 3 1 roll } def
+ tx@3DPlotDict begin
+ POrig Conv3D2D translate
+ #4 \pst@number\psunit mul dup 0 360 false
+ \pst@usecolor{\pslinecolor}
+ IIIDEllipse
+ end
+ }% end of pscode
+ \end@ClosedObj
+}\ignorespaces}
+%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\psplotinit#1{\xdef\psplot@init{#1 }}
@@ -1516,7 +1595,7 @@
% ================================================================
\ifx\psk@ThreeDplot@planecorr\ThreeDplot@planecorrOff
/SignFlag 1 def
- /AlphaOffset 0 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