summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-3dplot
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-09-12 18:38:04 +0000
committerKarl Berry <karl@freefriends.org>2006-09-12 18:38:04 +0000
commit6ab497ae05df040bd2c38540fbe0b6bcac7e66cb (patch)
tree9d462dc6354db77cb338adb373034b98a689d09a /Master/texmf-dist/tex/generic/pst-3dplot
parent899965daf71de8b1530f7edaf02b0d621faaf3ec (diff)
pst-3dplot update (7feb06)
git-svn-id: svn://tug.org/texlive/trunk@2110 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.tex463
1 files changed, 382 insertions, 81 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 990149460fe..e8812bd5102 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\PSTVueTroisDLoaded\endinput\else\input pst-vue3d.tex\fi
\ifx\PSTMultidoLoaded\endinput\else\input multido.tex\fi
%
-\def\fileversion{1.63}
-\def\filedate{2005/02/19}
+\def\fileversion{1.72}
+\def\filedate{2006/02/07}
\message{`PST-3dplot' v\fileversion, \filedate\space (HV)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
@@ -63,12 +63,15 @@
\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}[false]{\@nameuse{Pst@drawCoor#1}}
+\define@key[psset]{pst-3dplot}{drawCoor}[true]{\@nameuse{Pst@drawCoor#1}}
\newif\ifPst@hiddenLine% emulate hidden line surface?
-\define@key[psset]{pst-3dplot}{hiddenLine}[false]{\@nameuse{Pst@hiddenLine#1}}
+\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{SphericalCoor=false}
+\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}
%
% ------- the global definitions for the pspicture frame ------
%
@@ -81,6 +84,12 @@
\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}}
%
% -------------- the angles and the plotpoints -------------
%
@@ -90,6 +99,9 @@
\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}{zCoor}{\def\psk@ThreeDplot@zCoor{#1}}
+\psset[pst-3dplot]{zCoor=0}
+%
\def\drawStyle@xLines{xLines}% 0
\def\drawStyle@yLines{yLines}% 1
\def\drawStyle@xyLines{xyLines}% 2
@@ -205,6 +217,7 @@
\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,%
@@ -213,8 +226,10 @@
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%
+ planeGrid=xy,planeGridOffset=0,subticks=10,
+ leftHanded=false%
}%
+ \def\pst@linetype{2}% to prevent an unknown linetyp with dash
}
\setDefaults
%
@@ -246,6 +261,7 @@
/M31 RotY sin neg def
/M32 RotX sin RotY cos mul def
/M33 RotX cos RotY cos mul def
+ /leftHanded \ifPst@leftHanded true \else false \fi def
}%
%
% (#1) -> #1 #2 #3
@@ -286,8 +302,8 @@
%
\def\pstThreeDCoor{\pst@object{pstThreeDCoor}}
\def\pstThreeDCoor@i{%
- \pst@killglue
- \begingroup
+ \pst@killglue%
+ \begingroup%
\addbefore@par{linewidth=0.5pt,linecolor=red,arrows=->,dotstyle=|}%
\use@par%
\pstThreeDNode(\psk@ThreeDplot@xMin,0,0){xMin}%
@@ -307,11 +323,15 @@
% \ifnum\psk@ThreeDplot@Alpha=90\else
\pst@dimx=\psk@ThreeDplot@xMax\p@%
\pst@dima=\psk@ThreeDplot@xThreeDunit\p@%
- \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
\rA=\psk@Dx+\psk@Dx,%
- \rB=\psk@ThreeDplot@xThreeDunit+\psk@ThreeDplot@xThreeDunit}{\pst@cntx}{%
+ \rB=\psk@ThreeDplot@deltax+\psk@ThreeDplot@deltax}{\pst@cntx}{% the coor increment
+% \rB=\psk@ThreeDplot@xThreeDunit+\psk@ThreeDplot@xThreeDunit}{\pst@cntx}{%
\pstThreeDLine[arrows=-](\rB,-\psk@IIIDticksize,0)(\rB,\psk@IIIDticksize,0)%
\pstPlanePut[plane=\psk@IIIDxTicksPlane]%
(\rB,\psk@IIIDxticksep,0){\psxyzlabel{\rA}}%
@@ -369,7 +389,8 @@
\pstPlanePut[plane=\psk@IIIDzTicksPlane](0,\psk@IIIDzticksep,\rB){\psxyzlabel{\rA}}%
}%
\fi\fi%
- \endgroup\ignorespaces%
+ \endgroup%
+ \ignorespaces%
}
%
% planeGrids
@@ -400,25 +421,25 @@
\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=#1+\strip@pt\pst@dx}{\pst@cntx}{%
+ \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=#2+\strip@pt\pst@dy}{\pst@cnty}{%
+ \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=#1+\strip@pt\pst@dx}{\pst@cntx}{%
+ \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=#2+\strip@pt\pst@dy}{\pst@cnty}{%
+ \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=#1+\strip@pt\pst@dx}{\pst@cntx}{%
+ \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=#2+\strip@pt\pst@dy}{\pst@cnty}{%
+ \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
@@ -483,24 +504,24 @@
%
% set a 3d dot
%
-\def\pstThreeDDot{\@ifnextchar[{\pst@ThreeDDot}{\pst@ThreeDDot[]}}
-\def\pst@ThreeDDot[#1](#2,#3,#4){{%
- \pst@killglue
- \psset{linestyle=dashed,linewidth=0.5pt}% default
- \psset{#1}%
- \pstThreeDNode[#1](#2,#3,#4){A}%
+\def\pstThreeDDot{\pst@object{pst@ThreeDDot}}
+\def\pst@ThreeDDot@i(#1,#2,#3){%
+ \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%
\ifPst@drawCoor%
\addto@pscode{
\pst@3ddict
\variablesIIID
\ifPst@SphericalCoor
- #2\space #3\space #4\space
+ #1\space #2\space #3\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
+ /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
@@ -533,9 +554,9 @@
\fi
end
}%
- \use@pscode%
- \fi%
-}\ignorespaces}
+ \fi%
+ \end@SpecialObj%
+ \ignorespaces}
%
% transform the 3d coordinates of the node (#1,#2,#3)
% into a 2d node with the name #4
@@ -578,10 +599,7 @@
%
% Trangle [options](Point1)(Point2)(Point3)
%
-\def\pstThreeDTriangle{\@ifnextchar[%
- {\do@ThreeDTriangle}%
- {\do@ThreeDTriangle[]}%
-}
+\def\pstThreeDTriangle{\@ifnextchar[{\do@ThreeDTriangle}{\do@ThreeDTriangle[]}}
\def\do@ThreeDTriangle[#1](#2)(#3)(#4){{%
\ifx#1\empty\else\psset{#1}\fi%
\ifPst@drawCoor%
@@ -624,16 +642,16 @@
\pstThreeDDot(\pst@tempa,\pst@tempb,\pst@tempc)%
}%
\fi%
- \getThreeDCoor{#1}\pst@tempa%
- \getThreeDCoor{#2}\pst@tempb%
- \getThreeDCoor{#3}\pst@tempc%
+ \getThreeDCoor{#1}\pst@tempA%
+ \getThreeDCoor{#2}\pst@tempB%
+ \getThreeDCoor{#3}\pst@tempC%
\begin@OpenObj
\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@tempA\space } def % x y z or Radius longitude lattitude
+ /P2 { \pst@tempB\space } def %
+ /P3 { \pst@tempC\space } def %
/SphericalCoor \ifPst@SphericalCoor true \else false \fi def %
/xUnit { \pst@number\psxunit\space mul } def
/yUnit { \pst@number\psyunit\space mul } def
@@ -692,16 +710,6 @@
\ignorespaces%
}
%
-% Sphere
-%
-\def\pstThreeDSphere{\@ifnextchar[{\pst@ThreeDSphere}{\pst@ThreeDSphere[]}}
-\def\pst@ThreeDSphere[#1](#2,#3,#4)#5{{%
- \psset{THETA=\psk@ThreeDplot@Beta,PHI=\psk@ThreeDplot@Beta,Dobs=10,Decran=10}%
- \psset{#1}%
- \pstThreeDNode(#2,#3,#4){SphereCenter}%
- \rput(SphereCenter){\SphereThreeD(0,0,0){#5}}%
-}\ignorespaces}
-%
% set a 3d ellipse/circle
%
% #1 options
@@ -713,26 +721,28 @@
\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
+ \getThreeDCoor{#1}\pst@tempC% center
+ \getThreeDCoor{#2}\pst@tempA% a
+ \getThreeDCoor{#3}\pst@tempB% b
\addto@pscode{%
\pst@3ddict \variablesIIID end
\ifPst@SphericalCoor
- \pst@tempc\space \tx@ConvertToCartesian
+ \pst@tempC\space \tx@ConvertToCartesian
/zM \tx@Z def /yM \tx@Y def /xM \tx@X def % center
- \pst@tempa\space \tx@ConvertToCartesian
+ \pst@tempA\space \tx@ConvertToCartesian
/zA \tx@Z def /yA \tx@Y def /xA \tx@X def % a
- \pst@tempb\space \tx@ConvertToCartesian
+ \pst@tempB\space \tx@ConvertToCartesian
/zB \tx@Z def /yB \tx@Y def /xB \tx@X def % b
\else
- \pst@tempc\space /zM exch def /yM exch def /xM exch def % center
- \pst@tempa\space /zA exch def /yA exch def /xA exch def % a
- \pst@tempb\space /zB exch def /yB exch def /xB exch def % b
+ \pst@tempC\space /zM exch def /yM exch def /xM exch def % center
+ \pst@tempA\space /zA exch def /yA exch def /xA exch def % a
+ \pst@tempB\space /zB exch def /yB exch def /xB exch def % 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 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
/xyz {
xM xA angle cos mul add xB angle sin mul add
yM yA angle cos mul add yB angle sin mul add
@@ -777,6 +787,35 @@
\def\pstThreeDCircle{\pstThreeDEllipse}
\def\pstThreeDPlotFunc{\psplotThreeD}% only for compatibility
%
+%
+% cone[options](center){radius}{height}
+%
+\def\pstThreeDCone{\pst@object{pstThreeDCone}}
+\def\pstThreeDCone@i(#1)(#2)(#3)#4{{%
+ \pst@usepar
+ \pstThreeDEllipse(#1)(#2)(#3)%
+ \begin@OpenObj%
+ \getThreeDCoor{#1}\pst@tempA%
+ \getThreeDCoor{#2}\pst@tempB%
+ \getThreeDCoor{#3}\pst@tempC%
+ \addto@pscode{
+ \pst@3ddict
+ \variablesIIID
+ /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@OpenObj%
+}\ignorespaces}
+%
\def\pstRotNodeIIID{\pst@object{RotNodeIIID}}
\def\RotNodeIIID@i(#1,#2,#3)(#4,#5,#6)#7{%
\pst@killglue
@@ -801,6 +840,181 @@
\endgroup%
\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@getint{#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}
+%
+\def\pstParaboloid{\pst@object{pstParaboloid}}
+\def\pstParaboloid@i#1#2{% #1:height #2:radius
+\addto@par{viewpoint=0 0 0}%
+\begin@SpecialObj%
+\addto@pscode{%
+ /height #1 def
+ /radius #2 #1 sqrt div def
+ /increment \psk@ThreeDplot@increment\space def
+ /cmyk {} 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
+ } 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é
+ /pas 0.5 def
+ /pas10 {pas 10 div} bind def
+%
+ /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 caclculate2DPoint ] % 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
+ } def
+ /conditionGE { PSfacette 0 ge } def
+ /conditionLE { PSfacette 0 le } def
+ \ifPstThreeDplot@showInside
+ /condition { conditionGE } def
+ 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
+ \fi
+}%
+% fin du code ps
+ \showpointsfalse%
+ \end@SpecialObj%
+\ignorespaces}
+%
+% 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
+\begin@SpecialObj%
+\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
+ } 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
+ #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@CMYK\space % CMYK
+ \psk@ThreeDplot@xyzLight\space % xLight yLight zLight
+ tx@3DPlotDict begin MaillageSphere end
+}% fin du code ps
+ \showpointsfalse%
+ \end@SpecialObj%
+\ignorespaces}
+%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\psplotinit#1{\xdef\psplot@init{#1 }}
@@ -844,9 +1058,12 @@
/dy y1 y sub \psk@ThreeDplot@yPlotpoints\space dup 0 gt {div}{pop} ifelse def
/func {#5} def
/xyz {
- 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
+ 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
+ \psk@ThreeDplot@zCoor\space 0 gt { \psk@ThreeDplot@zCoor }{ func } ifelse
+ Beta cos mul add \pst@number\psyunit mul} def
}%
\psplotThreeD@xLines@ii
\else% curves
@@ -864,9 +1081,15 @@
/y #3\space \n@Y\space dy mul add def
/func {#5} def
/xyz {
- 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
+ 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
+ \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
}%
\psplotThreeD@xLines@iii%
\ifPst@hiddenLine }\fi%
@@ -932,9 +1155,15 @@
/dy y1 y sub \psk@ThreeDplot@yPlotpoints\space dup 0 gt {div}{pop} ifelse def
/func {#5} def
/xyz {
- 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
+ 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
+ \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
}%
\psplotThreeD@yLines@ii
\else% curves
@@ -952,9 +1181,15 @@
/x #1\space \n@X\space dx mul add def
/func {#5} def
/xyz {
- 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
+ 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
+ \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
}%
\psplotThreeD@yLines@iii%
\ifPst@hiddenLine }\fi%
@@ -1578,16 +1813,82 @@
%
\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%
+%\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{\pst@object{RotPointIIID}}% A real TeX solution
\def\RotPointIIID@i(#1,#2,#3)#4#5#6{%
\pst@killglue%
@@ -1606,11 +1907,11 @@
\pstSinCos{\psk@ThreeD@RotY}\pst@sinTheta\pst@cosTheta
\pstMul{\pst@xVala}{\pst@cosTheta}\pst@tempA
\pstMul{\pst@zVala}{\pst@sinTheta}\pst@tempB
- \pstSub{\pst@tempA}{\pst@tempB}\pst@xValb
+ \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
- \pstAdd{\pst@tempA}{\pst@tempB}\pst@zValb
+ \pstSub{\pst@tempB}{\pst@tempA}\pst@zValb
% z- axis
\pstSinCos{\psk@ThreeD@RotZ}\pst@sinTheta\pst@cosTheta
\pstMul{\pst@xValb}{\pst@cosTheta}\pst@tempA