summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-3dplot
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-08-20 00:09:19 +0000
committerKarl Berry <karl@freefriends.org>2007-08-20 00:09:19 +0000
commit5d15743e4114b97824c00eaa61eab488ba52b233 (patch)
tree96349eb65512f2fefd8a6d78c33462fa24834d0f /Master/texmf-dist/tex/generic/pst-3dplot
parent56c0da12a9fba35882b8b7073eb809804ebf1ee8 (diff)
pst-3dplot 1.75 (18aug07)
git-svn-id: svn://tug.org/texlive/trunk@4766 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.tex488
1 files changed, 261 insertions, 227 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 88063d0edd8..ddc1e59632f 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.74}
-\def\filedate{2007/06/17}
+\def\fileversion{1.75}
+\def\filedate{2007/08/15}
\message{`PST-3dplot' v\fileversion, \filedate\space (HV)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
@@ -63,12 +63,26 @@
\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@]{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}
+\define@key[psset]{pst-3dplot}{coorType}{%
+ \pst@getint{#1}\psk@ThreeDplot@coorType
+ \ifcase\psk@ThreeDplot@coorType
+ % 0 is the default
+ \or
+% \def\psk@ThreeDplot@Beta{0}
+ \or
+ \def\psk@ThreeDplot@Alpha{135}
+% \def\psk@ThreeDplot@Beta{0}
+ \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
+\psset[pst-3dplot]{drawing,drawCoor,hiddenLine=false,SphericalCoor=false,
+ leftHanded=false,coorType=0}
%
% ------- the global definitions for the pspicture frame ------
%
@@ -96,6 +110,7 @@
\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}}
\psset[pst-3dplot]{zCoor=0}
%
@@ -122,7 +137,7 @@
\define@key[psset]{pst-3dplot}{endAngle}{% for ellipse/circle arc
\def\psk@ThreeDplot@endAngle{#1}}
\define@key[psset]{pst-3dplot}{linejoin}{% how lines come together 0,1,2
- \def\psk@ThreeDplot@linejoin{#1}}
+ \def\psk@ThreeDplot@linejoin{#1 }}
\define@key[psset]{pst-3dplot}{plane}{% xy,xz,yz
\edef\psk@ThreeDplot@plane{#1}} % must be expanded
\define@key[psset]{pst-3dplot}{pOrigin}{% combination of (lr)(tBb)
@@ -134,10 +149,8 @@
%
% -------------- the length and node definitions -------------
%
-\define@key[psset]{pst-3dplot}{XO}{% the X-offset
- \def\psk@ThreeDplot@XO{#1}}
-\define@key[psset]{pst-3dplot}{YO}{% the y-offset
- \def\psk@ThreeDplot@YO{#1}}
+\define@key[psset]{pst-3dplot}{XO}{\def\psk@ThreeDplot@XO{#1}}% the X-offset
+\define@key[psset]{pst-3dplot}{YO}{\def\psk@ThreeDplot@YO{#1}}% the y-offset
\define@key[psset]{pst-3dplot}{angleStep}{% for circles
\def\psk@ThreeDplot@angleStep{#1}}
\define@key[psset]{pst-3dplot}{posStart}{% where the arrows start
@@ -151,8 +164,7 @@
\define@key[psset]{pst-3dplot}{invisibleLineStyle}{% offset for \arrowLine
\edef\psk@ThreeDplot@invisibleLineStyle{#1}}
%
-\newif\if@IIIDticks% draw the ticks?
-\define@key[psset]{pst-3dplot}{IIIDticks}[true]{\@nameuse{@IIIDticks#1}}
+\define@boolkey[psset]{pst-3dplot}[Pst@]{IIIDticks}[true]{}
\define@key[psset]{pst-3dplot}{Dz}{\def\psk@Dz{#1}}
\define@key[psset]{pst-3dplot}{IIIDxTicksPlane}{\def\psk@IIIDxTicksPlane{#1}}
\define@key[psset]{pst-3dplot}{IIIDyTicksPlane}{\def\psk@IIIDyTicksPlane{#1}}
@@ -161,18 +173,15 @@
\define@key[psset]{pst-3dplot}{IIIDxticksep}{\def\psk@IIIDxticksep{#1}}
\define@key[psset]{pst-3dplot}{IIIDyticksep}{\def\psk@IIIDyticksep{#1}}
\define@key[psset]{pst-3dplot}{IIIDzticksep}{\def\psk@IIIDzticksep{#1}}
-\define@key[psset]{pst-3dplot}{nameX}{% start of the object arrow
- \def\psk@ThreeDplot@nameX{#1}}
-\define@key[psset]{pst-3dplot}{spotX}{% where to draw the label
- \def\psk@ThreeDplot@spotX{#1}}
+\define@key[psset]{pst-3dplot}{nameX}{\def\psk@ThreeDplot@nameX{#1}}% start of the object arrow
+\define@key[psset]{pst-3dplot}{spotX}{\def\psk@ThreeDplot@spotX{#1}}% where to draw the label
\define@key[psset]{pst-3dplot}{nameY}{\def\psk@ThreeDplot@nameY{#1}}
\define@key[psset]{pst-3dplot}{spotY}{\def\psk@ThreeDplot@spotY{#1}}
\define@key[psset]{pst-3dplot}{nameZ}{\def\psk@ThreeDplot@nameZ{#1}}
\define@key[psset]{pst-3dplot}{spotZ}{\def\psk@ThreeDplot@spotZ{#1}}
%
% ### begin Torsten Suhling
-\define@key[psset]{pst-3dplot}{planecorr}{% make plane tags readable
- \def\psk@ThreeDplot@planecorr{#1}}
+\define@key[psset]{pst-3dplot}{planecorr}{\def\psk@ThreeDplot@planecorr{#1}}% make plane tags readable
\def\ThreeDplot@planecorrOff{off} % default
\def\ThreeDplot@planecorrNormal{normal} % make planes readable
\def\ThreeDplot@planecorrXYrot{xyrot} % and put tag for xy-plane
@@ -187,10 +196,15 @@
%
\define@key[psset]{pst-3dplot}{planeGrid}{\def\psk@planeGrid{#1}}
\define@key[psset]{pst-3dplot}{planeGridOffset}{\def\psk@planeGridOffset{#1}}
-\define@key[psset]{pst-3dplot}{subticks}{\def\psk@xsubticks{#1}\def\psk@ysubticks{#1}}
-\define@key[psset]{pst-3dplot}{xsubticks}{\def\psk@xsubticks{#1}}
-\define@key[psset]{pst-3dplot}{ysubticks}{\def\psk@ysubticks{#1}}
+%\define@key[psset]{pst-3dplot}{subticks}{\def\psk@xsubticks{#1}\def\psk@ysubticks{#1}}
+%\define@key[psset]{pst-3dplot}{xsubticks}{\def\psk@xsubticks{#1}}
+%\define@key[psset]{pst-3dplot}{ysubticks}{\def\psk@ysubticks{#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}{\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 }}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
@@ -201,6 +215,7 @@
\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 }
@@ -214,11 +229,11 @@
%
%
\def\setIIIDplotDefaults{%
- \psset[pst-3dplot]{%
+ \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,
+ RotX=0,RotY=0,RotZ=0,RotSequence=xyz,PlaneSequence={},
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,
@@ -227,15 +242,15 @@
Dz=1,IIIDticks=false,IIIDxTicksPlane=xy,IIIDyTicksPlane=yz,IIIDzTicksPlane=yz,
IIIDticksize=0.1,IIIDxticksep=-0.4,IIIDyticksep=-0.2,IIIDzticksep=0.2,
planecorr=off,
- planeGrid=xy,planeGridOffset=0,subticks=10,
- leftHanded=false,IIIDdAlpha=0
+ 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
}%
\def\pst@linetype{2}% to prevent an unknown linetyp with dash
}
\setIIIDplotDefaults
%
\def\variablesIIID{
-% 0 0 translate
/RotX \psk@ThreeD@RotX\space def
/RotY \psk@ThreeD@RotY\space def
/RotZ \psk@ThreeD@RotZ\space def
@@ -263,6 +278,9 @@
/M32 RotX sin RotY cos mul def
/M33 RotX cos RotY cos mul def
/leftHanded \ifPst@leftHanded true \else false \fi def
+ /coorType \psk@ThreeDplot@coorType\space def
+ \psk@ThreeDplot@xyzLight\space
+ /zLight ED /yLight ED /xLight ED
}%
%
% (#1) -> #1 #2 #3
@@ -270,31 +288,31 @@
\def\pst@getThreeDcoor(#1,#2,#3){%
\edef\pst@coorIIID{#1\space #2\space #3\space}%
}
-\def\pst@addThreeDVec(#1)(#2)#3#4#5{%
+\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@subThreeDVec(#1)(#2,#3,#4)#5#6#7{%
+\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@calcThreeDVec(#1,#2,#3)(#4,#5,#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}%
+\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
@@ -320,7 +338,7 @@
\uput[\psk@ThreeDplot@spotX](xMax){\psk@ThreeDplot@nameX}%
\uput[\psk@ThreeDplot@spotY](yMax){\psk@ThreeDplot@nameY}%
\uput[\psk@ThreeDplot@spotZ](zMax){\psk@ThreeDplot@nameZ}%
- \if@IIIDticks%
+ \ifPst@IIIDticks%
% \ifnum\psk@ThreeDplot@Alpha=90\else
\pst@dimx=\psk@ThreeDplot@xMax\p@%
\pst@dima=\psk@ThreeDplot@xThreeDunit\p@%
@@ -418,8 +436,8 @@
\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
+ \pst@cntx=\psk@xsubticks \advance\pst@cntx by \@ne
+ \pst@cnty=\psk@ysubticks \advance\pst@cnty by \@ne
\psset{unit=1pt,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}{%
@@ -520,9 +538,9 @@
#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
+ /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 \pst@number\psxunit\space mul
@@ -626,32 +644,30 @@
% (#3) first direction vector ux,uy,uz
% (#4) second direction vector wx,wy,wz
%
-\def\pstThreeDSquare{\pst@object{squareIIID}}
-\def\squareIIID@i{\squareIIID@ii}
-\def\squareIIID@ii(#1)(#2)(#3){%
- \ifPst@drawCoor%
- {%
+\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)%
+ \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)%
}%
- \fi%
- \getThreeDCoor{#1}\pst@tempA%
- \getThreeDCoor{#2}\pst@tempB%
- \getThreeDCoor{#3}\pst@tempC%
- \begin@OpenObj
+ \fi
+ \getThreeDCoor{#1}\pst@tempAA
+ \getThreeDCoor{#2}\pst@tempBB
+ \getThreeDCoor{#3}\pst@tempCC
+ \begin@ClosedObj
\addto@pscode{%
\pst@3ddict
\variablesIIID
- /P1 { \pst@tempA\space } def % x y z or Radius longitude lattitude
- /P2 { \pst@tempB\space } def %
- /P3 { \pst@tempC\space } def %
+ /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
@@ -675,7 +691,7 @@
\pst@cp\space \psline@iii\space \tx@Line\space closepath
end
}%
- \end@OpenObj%
+ \end@ClosedObj%
}
%
@@ -691,18 +707,18 @@
\begingroup%
\psset{linestyle=\psk@ThreeDplot@invisibleLineStyle}%
\psset{#1}%
- \pstVerb{ \pst@3ddict \variablesIIID end }%
+% \pstVerb{ \pst@3ddict \variablesIIID\space end }%
\iftrue
\pstThreeDSquare[#1](#2)(#4)(#5) % lower square
\pstThreeDSquare(#2)(#3)(#4)% back square
%
\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
- \pst@addThreeDVec(#2)(#5)\pst@tempa\pst@tempb\pst@tempc
- \pstThreeDSquare[#1](\pst@tempa,\pst@tempb,\pst@tempc)(#3)(#4)% front square
+ \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
+ \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
@@ -807,11 +823,11 @@
\def\pstThreeDPlotFunc{\psplotThreeD}% only for compatibility
%
%
-% cone[options](center){radius}{height}
+% cone[options](center)(radiusA vec)(radiusB vec){height}
%
\def\pstThreeDCone{\pst@object{pstThreeDCone}}
\def\pstThreeDCone@i(#1)(#2)(#3)#4{{%
- \pst@usepar
+ \use@par
\pstThreeDEllipse(#1)(#2)(#3)%
\begin@OpenObj%
\getThreeDCoor{#1}\pst@tempA%
@@ -827,7 +843,8 @@
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
+ 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
@@ -860,25 +877,16 @@
\ignorespaces}
%
% Paraboloid (Idea is from Manuel ... )
-\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@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}}
-\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
+\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{%
- /height #1 def
- /radius #2 #1 sqrt div def
+ /height #4 def
+ /radius #5 #4 sqrt div def
/increment \psk@ThreeDplot@increment\space def
- /cmyk {} def
/viewpoint {
\psk@viewpoint
\psk@ThreeDplot@Beta\space sin add 3 1 roll
@@ -886,120 +894,34 @@
\psk@ThreeDplot@Alpha\space sin add \psk@ThreeDplot@Beta\space cos mul 3 1 roll
} def
0 viewpoint 0 \tx@SetMatrixThreeD
- viewpoint /vZ ED /vY ED /vX ED
- 1 setlinejoin
- % les rayons de lumière
- /xLight 1 def
- /yLight 0.1 def
- /zLight 0.2 def
- % précision du tracè
+ viewpoint
+ \pst@3ddict /vZ ED /vY ED /vX ED
+ \variablesIIID
+ \psk@ThreeDplot@linejoin setlinejoin
/pas 0.5 def
- /pas10 {pas 10 div} bind def
+ /pas10 pas 10 div def
+ /cmyk {} def % we need only the values
+ \psk@ThreeDplot@SegmentColor\space
+% \psk@ThreeDplot@xyzLight\space % xLight yLight zLight
%
- /NormeLight {xLight dup mul yLight dup mul zLight dup mul add add sqrt} bind def
-% l'ellipse du plan de coupe : le contour
/calculate2DPoint { % four values on stack; x2D y2D are returned
/V0 ED /Z0 ED /U20 ED /U10 ED
- U10 cos V0 mul radius mul \pst@number\psunit mul
- U20 sin V0 mul radius mul \pst@number\psunit mul
- Z0 \pst@number\psunit mul \tx@ProjThreeD
- } def
- /PlanCoupe {
- /Z height store
- /V {Z sqrt} bind def
- /TableauxPoints [
- 0 1 359 {
- /U exch def [ U U Z V calculate2DPoint ] % on décrit le cercle
- } for
- ] def
- newpath
- TableauxPoints 0 get aload pop moveto
- 0 1 359 {
- /compteur exch def
- TableauxPoints compteur get aload pop
- lineto } for
- closepath
- } def
-%
- /facette {
- newpath
- U U Z V calculate2DPoint moveto
- U 1 U increment add {%
- /U1 exch def
- U1 U1 Z V calculate2DPoint lineto
- } for
- Z pas10 Z pas add pas10 add{
- /Z1 exch def
- /V {Z1 sqrt} bind def
- U1 U1 Z1 V calculate2DPoint lineto
- } for
- U increment add -1 U {%
- /U2 exch def
- U2 U2 Z pas add V calculate2DPoint lineto
- } for
- Z pas add pas10 sub pas10 neg Z pas10 sub{
- /Z2 exch def
- /V {Z2 abs sqrt} bind def
- U U Z2 V calculate2DPoint lineto
- } for
- closepath
- } def % facette
-%
- /MaillageParaboloid {
- 0 pas height pas sub{%
- /Z ED
- /V {Z sqrt} bind def
- 0 increment 360 increment sub {%
- /U exch def
-% Centre de la facette
- /Ucentre {U increment 2 div add} bind def
- /Vcentre {Z pas 2 div add sqrt} bind def
-% normale à la facette
- /nXfacette {2 Vcentre dup mul mul Ucentre cos mul radius mul} bind def
- /nYfacette {2 Vcentre dup mul mul Ucentre sin mul radius mul} bind def
- /nZfacette {Vcentre neg radius dup mul mul} bind def
- /NormeN {
- nXfacette dup mul
- nYfacette dup mul
- nZfacette dup mul
- add add sqrt} bind def
- NormeN 0 eq {/NormeN 1e-10 def} if
-% test de visibilité
- /PSfacette vX nXfacette mul
- vY nYfacette mul add
- vZ nZfacette mul add def
- condition {
- facette
- /cosV {1 xLight nXfacette mul
- yLight nYfacette mul
- zLight nZfacette mul
- add add
- NormeLight
- NormeN mul div sub} bind def
- \psk@ThreeDplot@SegmentColor\space
- 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
- facette
- stroke
- } if
- } for
- } for
+ 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
} def
- /conditionGE { PSfacette 0 ge } def
- /conditionLE { PSfacette 0 le } def
+ /condition { PSfacetteParaboloid 0 le } def
+ true MaillageParaboloid
+ /condition { PSfacetteParaboloid 0 ge } def
+ false MaillageParaboloid
\ifPstThreeDplot@showInside
- /condition { conditionGE } def
- MaillageParaboloid
+ /condition { PSfacetteParaboloid 0 ge } def
+ false MaillageParaboloid
vZ 0 ge {
- PlanCoupe 1 0.5 0.5 setrgbcolor fill
- PlanCoupe 0 setgray stroke } if
- \else
- /condition { conditionLE } def
- MaillageParaboloid
- /condition { conditionGE } def
- MaillageParaboloid
+ PlanCoupeParaboloid 1 0.5 0.5 setrgbcolor fill
+ PlanCoupeParaboloid 0 setgray stroke } if
\fi
+ end
}%
% fin du code ps
\showpointsfalse%
@@ -1011,6 +933,7 @@
\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{%
/viewpoint {% to make it compatible with parallel projection
\psk@viewpoint
@@ -1027,9 +950,10 @@
\psk@ThreeDplot@increment\space
/cmyk {} def % we need only the values
\psk@ThreeDplot@SegmentColor\space
-% \psk@ThreeDplot@CMYK\space % CMYK
- \psk@ThreeDplot@xyzLight\space % xLight yLight zLight
- tx@3DPlotDict begin MaillageSphere end
+% \psk@ThreeDplot@xyzLight\space % xLight yLight zLight
+ tx@3DPlotDict begin
+ \variablesIIID
+ MaillageSphere end
}% fin du code ps
\showpointsfalse%
\end@SpecialObj%
@@ -1094,6 +1018,119 @@
\end@ClosedObj
}\ignorespaces}
%
+%-------------------------- Cylinder ----------------------------
+%
+\def\psCylinder{\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
+ \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
+ } def
+ 0 viewpoint 0 \tx@SetMatrixThreeD
+ viewpoint
+ \pst@3ddict /vZ ED /vY ED /vX ED
+ \variablesIIID 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
+ 0.5 % height increment
+ /cmyk {} def % we need only the values
+ \psk@ThreeDplot@SegmentColor\space
+%
+ \tx@3DPlotDict
+ /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{\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{#5}
+\begin@SpecialObj%
+\use@par
+\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
+ } def
+ 0 viewpoint 0 \tx@SetMatrixThreeD
+ viewpoint
+ \tx@3DPlotDict
+ /vZ ED /vY ED /vX ED
+ \variablesIIID
+ \psk@ThreeDplot@linejoin setlinejoin
+%
+ #1 #2 #3
+ \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 }}
@@ -1418,7 +1455,7 @@
\@nameuse{endplot@\psplotstyle}%
}
%
-% Plot 3D data
+%------------------------ Plot 3D data --------------------------
%
\def\fileplotThreeD{\def\pst@par{}\pst@object{fileplotThreeD}}
\def\fileplotThreeD@i#1{%
@@ -1489,26 +1526,26 @@
%
%
\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
- 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)
- m 1 sub 1 roll m 1 sub 1 roll /m m 3 sub def } repeat>
+ 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)
+ m 1 sub 1 roll m 1 sub 1 roll /m m 3 sub def } repeat>
%
% listplotThreeD
%
@@ -1516,10 +1553,7 @@
\def\listplotThreeD@i#1{\listplotThreeD@ii{\addto@pscode{#1}}}
\def\listplotThreeD@ii#1{%
\@nameuse{beginplot@\psplotstyle}%
- \addto@pscode{%
- \variablesIIID
- /D {} def mark %
- }%
+ \addto@pscode{ \variablesIIID /D {} def mark }%
#1%
\addto@pscode{\tx@ScalePointsThreeD}%
\@nameuse{endplot@\psplotstyle}%