summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-mirror
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-02-18 22:50:16 +0000
committerKarl Berry <karl@freefriends.org>2014-02-18 22:50:16 +0000
commit08d2b2d2d99819f17efdf5fea76b3f485c5a6ce1 (patch)
tree19d6cf77d57f92809adde775ffb7f65973041834 /Master/texmf-dist/tex/generic/pst-mirror
parent1bf884494029484b848f0d3a04324cab50b93b28 (diff)
pst-mirror (18feb14)
git-svn-id: svn://tug.org/texlive/trunk@32997 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-mirror')
-rw-r--r--Master/texmf-dist/tex/generic/pst-mirror/pst-mirror.tex391
1 files changed, 305 insertions, 86 deletions
diff --git a/Master/texmf-dist/tex/generic/pst-mirror/pst-mirror.tex b/Master/texmf-dist/tex/generic/pst-mirror/pst-mirror.tex
index df2f18d1738..dcb63ab6761 100644
--- a/Master/texmf-dist/tex/generic/pst-mirror/pst-mirror.tex
+++ b/Master/texmf-dist/tex/generic/pst-mirror/pst-mirror.tex
@@ -1,4 +1,4 @@
-%% $Id: pst-mirror.tex 168 2009-12-08 17:55:07Z herbert $
+%% $Id: pst-mirror.tex 894 2014-02-18 09:46:21Z herbert $
%%
%% This is file `pst-mirror.tex',
%%
@@ -6,7 +6,7 @@
%%
%% Package `pst-mirror.tex'
%%
-%% MAnuel Luque
+%% Manuel Luque
%% Herbert Voss
%%
%% This program can be redistributed and/or modified under the terms
@@ -17,7 +17,6 @@
%% `pst-mirror' is a PSTricks package to view objects ob a spherical sphere
%%
%%
-%
\csname PSTMirrorLoaded\endcsname
\let\PSTMirrorLoaded\endinput
% Requires PSTricks, pst-xkey and pst-node packages
@@ -26,8 +25,9 @@
\ifx\PSTnodesLoaded\endinput\else\input pst-node \fi
\ifx\MultidoLoaded\endinput \else\input multido.tex \fi
%
-\def\fileversion{1.00}
-\def\filedate{2009/12/08}%
+%\def\fileversion{1.00} CTAN
+\def\fileversion{1.01}
+\def\filedate{2014/02/17}%
\message{`pst-mirror v\fileversion, \filedate\space (ml,hv)}%
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
@@ -104,6 +104,7 @@
0 0 translate
/cm { \pst@number\psunit mul } def
/cm_1 { \pst@number\psunit div } def
+ /unit_image {\pst@number\psunit div 10 mul} bind def
%% Caracteres accentues
/ReEncode { exch findfont
dup length dict begin { 1 index /FID eq {pop pop} {def} ifelse
@@ -177,9 +178,9 @@
end } def
}%
-\def\pstTextSphere{\pst@object{pstTextSphere}}
-\def\pstTextSphere@i{\@ifnextchar({\pstTextSphere@ii}{\pstTextSphere@ii(0,0,0)}}
-\def\pstTextSphere@ii(#1,#2,#3)#4{%
+\def\pstSphereText{\pst@object{pstSphereText}}
+\def\pstSphereText@i{\@ifnextchar({\pstSphereText@ii}{\pstSphereText@ii(0,0,0)}}
+\def\pstSphereText@ii(#1,#2,#3)#4{%
\begin@ClosedObj
\addto@pscode{%
\variables@Sphere
@@ -196,7 +197,7 @@
5 dict begin
/Ypoint exch cm_1 y0 add def
/Xpoint exch cm_1 x0 add def
- %% coordonnées dans le repère absolu
+ %% coordonnees dans le repare absolu
2dto3d
/Zpoint exch def
/Ypoint exch def
@@ -205,8 +206,8 @@
3dto2d
end
} bind def
- #1 #2 #3 tx@TransformPlan
- tx@WARP
+ #1 #2 #3 \tx@TransformPlan
+ \tx@WARP
0 0 moveto
warptxt true charpath
10 currentpathsegmenteline
@@ -217,39 +218,37 @@
}%
\end@ClosedObj\ignorespaces}
%
-\def\pstCube{\pst@object{pstCube}}
-\def\pstCube@i{%
+\def\pstSphereCube{\pst@object{pstSphereCube}}
+\def\pstSphereCube@i{%
\pst@killglue
\begin@ClosedObj
\addto@pscode{%
\variables@Sphere
- tx@Sphere3DDict begin
- Cube
- end
+ tx@Sphere3DDict begin Cube end
}% fin du code ps
\end@ClosedObj\ignorespaces}
%
-\def\pstDie{%
- \pstCube
- \begin@ClosedObj
+\def\pstSphereDie{\pst@object{pstSphereDie}}
+\def\pstSphereDie@i{%
+ \pst@killglue
+ \begingroup%
+ \use@par
+ \pstSphereCube
+ \begin@SpecialObj
\addto@pscode{%
\variables@Sphere
- tx@Sphere3DDict begin
- Cube
- PointsDie
- end
+ tx@Sphere3DDict begin Cube PointsDie end
}% fin du code ps
- \end@ClosedObj}
+ \end@SpecialObj%
+ \endgroup\ignorespaces%
+}
%
-\def\pstTetraedre{\pst@object{pstTetraedre}}
-\def\Tetraedre@i{%
+\def\pstSphereTetraedre{\pst@object{pstSphereTetraedre}}
+\def\pstSphereTetraedre@i{%
\pst@killglue
\begin@ClosedObj
\addto@pscode{%
- \variables@Sphere
- tx@Sphere3DDict begin
- Tetraedre
- end
+ \variables@Sphere tx@Sphere3DDict begin Tetraedre end
}% fin du code ps
\end@ClosedObj\ignorespaces}
%
@@ -262,21 +261,13 @@
\begin@SpecialObj
\pnode(!
\variables@Sphere
- /Zcote #3 def
- /Xabscisse #1 def
- /Yordonnee #2 def
+ /Zcote #3 def /Xabscisse #1 def /Yordonnee #2 def
tx@Sphere3DDict begin
FormulesSphere
Xi reduction mul Yi reduction mul
end){#4}
\end@SpecialObj\ignorespaces}
%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% \psSphereLine est
-%% adapté de la macro \pstThreeDLine du package pst-3dplot (H.Voss)
-%% http://tug.ctan.org/tex-archive/graphics/pstricks/contrib/pst-3dplot
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% 7 juillet 2008
\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}%
@@ -292,51 +283,49 @@
}
\def\pstSphereLine@ii{%
\addto@pscode{%
- ] /LesPoints exch def
-\variables@Sphere
-tx@Sphere3DDict begin
-/n1 LesPoints length 3 div cvi def % nbre de points
-/i 0 def
-/TableauPoints [
-n1 {
- [ LesPoints i get
- LesPoints i 1 add get
- LesPoints i 2 add get
- ]
- /i i 3 add def
- }repeat
- ] def
+ ]
+ /LesPoints exch def
+ \variables@Sphere
+ tx@Sphere3DDict begin
+ /n1 LesPoints length 3 div cvi def % nbre de points
+ /i 0 def
+ /TableauPoints [
+ n1 {
+ [ LesPoints i get LesPoints i 1 add get LesPoints i 2 add get ]
+ /i i 3 add def
+ } repeat
+ ] def
% Tableau general des points
-/TAB [
-0 1 n1 2 sub {/i ED
- TableauPoints i get aload pop
- /Z1 ED /Y1 ED /X1 ED
- TableauPoints i 1 add get aload pop
- /Z2 ED /Y2 ED /X2 ED
-0 0.01 1.0 { % k
- /K exch def
- [
- /Zcote K Z2 mul 1 K sub Z1 mul add def
- /Xabscisse K X2 mul 1 K sub X1 mul add def
- /Yordonnee K Y2 mul 1 K sub Y1 mul add def
- CalcCoordinates
- ]
+ /TAB [
+ 0 1 n1 2 sub {/i ED
+ TableauPoints i get aload pop
+ /Z1 ED /Y1 ED /X1 ED
+ TableauPoints i 1 add get aload pop
+ /Z2 ED /Y2 ED /X2 ED
+ 0 0.01 1.0 { % k
+ /K exch def
+ [
+ /Zcote K Z2 mul 1 K sub Z1 mul add def
+ /Xabscisse K X2 mul 1 K sub X1 mul add def
+ /Yordonnee K Y2 mul 1 K sub Y1 mul add def
+ CalcCoordinates
+ ]
+ } for
} for
-} for
-] def
-/n2 TAB length def
- TAB 0 get aload pop moveto
-0 1 n2 1 sub {
+ ] def
+ /n2 TAB length def
+ TAB 0 get aload pop moveto
+ 0 1 n2 1 sub {
/compteur exch def
TAB compteur get aload pop
lineto } for
% fin du tracé de la ligne
-end
- }\end@OpenObj%
+ end }%
+ \end@OpenObj%
\ignorespaces%
\SpecialCoor%
}
-
+%
\def\pstSpherePolygon{\NormalIIIDCoor\pst@object{pstSpherePolygon}}
\def\pstSpherePolygon@i{%
\pst@killglue%
@@ -349,17 +338,12 @@ end
\addto@pscode{%
] /LesPoints exch def
\variables@Sphere
- tx@Sphere3DDict begin
/n1 LesPoints length 3 div cvi def % nbre de points
/i 0 def
/TableauPoints [
- n1 {
- [ LesPoints i get
- LesPoints i 1 add get
- LesPoints i 2 add get
- ]
+ n1 { [ LesPoints i get LesPoints i 1 add get LesPoints i 2 add get ]
/i i 3 add def
- }repeat
+ } repeat
] def
% Tableau general des points
/TAB [
@@ -373,7 +357,7 @@ end
[ /Zcote K Z2 mul 1 K sub Z1 mul add def
/Xabscisse K X2 mul 1 K sub X1 mul add def
/Yordonnee K Y2 mul 1 K sub Y1 mul add def
- CalcCoordinates ]
+ tx@Sphere3DDict begin CalcCoordinates end ]
} for
} for
] def
@@ -386,7 +370,6 @@ end
lineto
} for
closepath
- end
}%
\end@ClosedObj%
\ignorespaces%
@@ -1289,8 +1272,8 @@ end
}% fin du code ps
\end@ClosedObj}\ignorespaces}
%
-\def\pstPyramide{\pst@object{pstPyramide}}
-\def\pstPyramide@i{%
+\def\pstSpherePyramide{\pst@object{pstSpherePyramide}}
+\def\pstSpherePyramide@i{%
\begin@SpecialObj
\pstFaceSAB[fillcolor=\psk@Sphere@TetraedreColorFaceA]%
\pstFaceSBC[fillcolor=\psk@Sphere@TetraedreColorFaceB]%
@@ -1299,6 +1282,242 @@ end
\pstFaceABCD[fillcolor=\psk@Sphere@TetraedreColorFaceE]%
\end@SpecialObj}
%
+%% === Chemin pour les dessins ---------------------------------------------
+\define@key[psset]{pst-mirror}{path}{\edef\psk@mirror@Path{#1}} % chemin des dessins
+\psset{path=}
+%
+%%%% ajout le 28/10/2011 --------------------------------------
+\def\pstSphereImage{\def\pst@par{}\pst@object{pstSphereImage}}
+\def\pstSphereImage@i{\@ifnextchar({\pstSphereImage@ii}{\pstSphereImage@ii(0,0,0)}}
+\def\pstSphereImage@ii(#1,#2,#3)#4{{%
+ \begin@SpecialObj
+ \addto@pscode{%
+ \variables@Sphere
+ #1 %
+ #2 %
+ #3 %
+\tx@TransformPlan
+/fichier (\psk@mirror@Path#4) def
+\ifPst@visibility /Condition { gt } def \else /Condition { le } def \fi
+ gsave
+ /showpage {} def
+ tx@Sphere3DImageDict begin
+ fichier run
+ end
+ grestore
+ }%
+ \end@SpecialObj}%
+ \ignorespaces}
+%
+\def\psparametricplotSphere{\pst@object{parametricplotSphere}}%
+\def\parametricplotSphere{\pst@object{parametricplotSphere}}
+\def\parametricplotSphere@i#1#2{\@ifnextchar[{\parametricplotSphere@x{#1}{#2}}{\parametricplotSphere@x{#1}{#2}[]}}
+\def\parametricplotSphere@x#1#2[#3]{\@ifnextchar[{\parametricplotSphere@xi{#1}{#2}[#3]}{\parametricplotSphere@xi{#1}{#2}[#3][]}}
+\def\parametricplotSphere@xi#1#2[#3][#4]#5{%
+ \pst@killglue%
+ \begingroup%
+ \use@par%
+ \@nameuse{beginplot@\psplotstyle}%
+ \addto@pscode{%
+ \variables@Sphere
+ \psk@Sphere@Xorigine\space
+ \psk@Sphere@Yorigine\space
+ \psk@Sphere@Zorigine\space
+ \tx@TransformPlan
+ #3 %prefix PS code
+ \psplot@init
+ /t #1 def
+ /t1 #2 def
+ /dt t1 t sub \psk@plotpoints div def
+ /F@pstplot \ifPst@algebraic (#5)
+ \ifx\psk@PlotDerivative\@none\else
+ \psk@PlotDerivative\space { (t) tx@Derive begin Derive end } repeat
+ \fi\space
+ tx@AlgToPs begin AlgToPs end cvx
+ \else { #5 } \fi def
+ \ifPst@VarStep
+ /StillZero 0 def /LastNonZeroStep dt def
+ /F2@pstplot tx@Derive begin (#5) (t) Derive (t) Derive end
+ \ifx\psk@PlotDerivative\@none\else
+ \psk@PlotDerivative\space { (t) tx@Derive begin Derive end } repeat
+ \fi\space
+ tx@AlgToPs begin AlgToPs end cvx def
+ %% computation of the tolerance defined by plotpoints
+ /epsilon12 \ifx\psk@VarStepEpsilon\@default
+ tx@Derive begin F2@pstplot end Pyth
+ dt 3 exp abs mul
+ \else\psk@VarStepEpsilon\space 12 mul \fi def
+ /ComputeStep {
+ dup 1e-4 lt
+ { pop StillZero 2 ge { LastNonZeroStep 2 mul } { LastNonZeroStep } ifelse /StillZero StillZero 1 add def }
+ { epsilon12 exch div 1 3 div exp /StillZero 0 def }
+ ifelse } bind def
+ \fi
+ /xy {
+ \ifPst@algebraic F@pstplot \else #5 \fi
+% \pst@number\psyunit mul exch
+% \pst@number\psxunit mul exch
+ /Ypoint exch def /Xpoint exch def
+% tx@mirror3DDict begin
+ 2dto3d
+ /Zpoint exch def
+ /Ypoint exch def
+ /Xpoint exch def
+ CalculsPointsApresTransformations
+ 3dto2d
+% end
+ } def
+ }%
+ \gdef\psplot@init{}%
+ \@pstfalse
+ \@nameuse{testqp@\psplotstyle}%
+ \if@pst\parametricplotSphere@ii{#4}\else\parametricplotSphere@iii{#4}\fi
+ \endgroup%
+ \ignorespaces}
+%
+\def\parametricplotSphere@ii#1{% para is the post code
+ \ifPst@VarStep%
+ \addto@pscode{%
+ mark xy \@nameuse{beginqp@\psplotstyle}
+ { F2@pstplot Pyth ComputeStep
+ t 2 copy add dup t1 gt {pop t1} if /t exch def F2@pstplot Pyth ComputeStep
+ /t 3 -1 roll def 2 copy gt { exch } if pop
+ /t t 3 -1 roll add dup t1 gt {pop t1} if def
+ xy \@nameuse{doqp@\psplotstyle}
+ t t1 eq { exit } if } loop}%
+ \else\pst@killglue%
+ \addto@pscode{%
+ /ps@Exit false def
+ xy \@nameuse{beginqp@\psplotstyle}
+ \psk@plotpoints 1 sub {
+ /t t dt add def
+ xy \@nameuse{doqp@\psplotstyle}
+ ps@Exit { exit } if
+ } repeat
+ ps@Exit not {
+ /t t1 def
+ xy \@nameuse{doqp@\psplotstyle}
+ } if
+ }%
+ \fi%
+ \addto@pscode{ #1 }%
+ \@nameuse{endqp@\psplotstyle}}
+%
+\def\parametricplotSphere@iii#1{%
+ \ifPst@VarStep%
+ \addto@pscode{%
+ /n 2 def
+ mark
+ { xy n 2 roll F2@pstplot Pyth
+ ComputeStep t 2 copy add dup t1 gt {pop t1} if
+ /t exch def F2@pstplot Pyth ComputeStep
+ /t 3 -1 roll def 2 copy gt { exch } if pop
+ /t t 3 -1 roll dup /LastNonZeroStep exch def add dup t1 gt {pop t1} if def /n n 2 add def
+ t t1 eq { exit } if } loop
+ xy n 2 roll}%
+ \else\pst@killglue%
+ \addto@pscode{
+ mark
+ /n 2 def
+ \psk@plotpoints {
+ xy
+ n 2 roll
+ /n n 2 add def
+ /t t dt add def
+ } repeat
+ /t t1 def
+ xy
+ n 2 roll}%
+ \fi%
+ \addto@pscode{ #1 }%
+ \@nameuse{endplot@\psplotstyle}}
+%
+\pst@def{WARP}<%
+%% D'après un fichier original de
+%%(c) P. Kleiweg 1997
+%% adapté par :
+%% Manuel Luque
+%% Arnaud Schmittbuhl
+%% Jean-Paul Vignault
+%% les commentaires sont de Jean-Paul Vignault
+/warpmove{
+ %% on teste le booleen place 2 tokens plus en avant sur la pile
+ %% si c'est 'true', alors on en est au 1er appel => on initialise
+ %% le chemin
+ 2 index {
+ newpath
+ } if
+ %% puis on applique warp a notre point
+ warp moveto
+ %% on enleve le 'true' pour mettre un 'false' a la place
+ pop false
+} bind def
+%% pour remplacer 'lineto
+/warpline {
+ warp lineto
+} bind def
+%% pour remplacer 'curveto'
+/warpcurve {
+ 6 2 roll warp
+ 6 2 roll warp
+ 6 2 roll warp
+ curveto
+} bind def
+%% 'warpit' declenche la transformation du chemin courant
+/warpit {
+true
+{ warpmove } { warpline } { warpcurve } { closepath } pathforall
+pop
+} bind def
+>%
+
+\pst@def{PathForAll}<%
+/warp {
+4 dict begin
+ /Ypoint exch def %
+ /Xpoint exch def %
+%% coordonnées dans le repère absolu
+ 2dto3d
+ /Zpoint exch def
+ /Ypoint exch def
+ /Xpoint exch def
+ CalculsPointsApresTransformations
+%% les coordonnées sur l'écran dans la représentation en perspective
+ 3dto2d
+end
+} bind def
+\tx@WARP
+%% maintenant on y va
+% 0 0 moveto
+ warpit %% on applique le pathforall
+ >%
+
+\pst@def{TransformPlan}< % le calcul des coefficients
+%% pour passer des coordonnées du plan aux coordonnées
+%% (x,y,z) du repère absolu
+%% les coordonnées sphériques du vecteur normal
+%% au plan
+%% l'origine du plan
+/zO' exch def
+/yO' exch def
+/xO' exch def
+%% les coefficients de la matrice de transformation
+/C11 {K_theta sin neg} def
+/C12 {K_theta cos K_phi sin mul neg} bind def
+/C21 {K_theta cos} bind def
+/C22 {K_phi sin K_theta sin mul neg } bind def
+/C31 {K_phi cos} bind def
+/2dto3d{
+%% coordonnées dans le repère absolu
+3 dict begin
+ C11 Xpoint mul C12 Ypoint mul add xO' add % x
+ C21 Xpoint mul C22 Ypoint mul add yO' add % y
+ C31 Ypoint mul zO' add
+end }
+ def
+ >%
+
+%
\catcode`\@=\PstAtCode\relax
%% END: pst-mirror.tex
\endinput