summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-diffraction
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-09-28 18:52:09 +0000
committerKarl Berry <karl@freefriends.org>2007-09-28 18:52:09 +0000
commitb76bd590ae0a6d1fadac72c841e88b8e02ca6ae0 (patch)
tree412bdd654168374a445229746ab62080a272044f /Master/texmf-dist/tex/generic/pst-diffraction
parent06cb469ce2c4a637d5751a35f9c4d295361c6c63 (diff)
pst-diffraction (27sep07)
git-svn-id: svn://tug.org/texlive/trunk@5058 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-diffraction')
-rw-r--r--Master/texmf-dist/tex/generic/pst-diffraction/pst-diffraction.tex200
1 files changed, 144 insertions, 56 deletions
diff --git a/Master/texmf-dist/tex/generic/pst-diffraction/pst-diffraction.tex b/Master/texmf-dist/tex/generic/pst-diffraction/pst-diffraction.tex
index d00c540e315..842e2721544 100644
--- a/Master/texmf-dist/tex/generic/pst-diffraction/pst-diffraction.tex
+++ b/Master/texmf-dist/tex/generic/pst-diffraction/pst-diffraction.tex
@@ -22,10 +22,11 @@
\let\PSTDiffractionLoaded\endinput
% Require PSTricks
\ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi
+\ifx\PSTThreeDplotLoaded\endinput\else\input pst-3dplot.tex\fi
\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi
%
-\def\fileversion{2.10b}%
-\def\filedate{2007/09/07}%
+\def\fileversion{2.02}%
+\def\filedate{2007/09/25}%
\message{`PST-diffraction v\fileversion, \filedate\space (ML,hv)}%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
\pst@addfams{pst-diff}
@@ -35,6 +36,7 @@
\define@key[psset]{pst-diff}{r}{\def\psk@Diffraction@Circular@r{#1 }} % rayon du trou en m
\define@key[psset]{pst-diff}{d}{\def\psk@Diffraction@Circular@d{#1 }} % demi-distance entre les trous en m
\define@key[psset]{pst-diff}{h}{\def\psk@Diffraction@Triangle@h{#1 }} % hauteur du triangle en m
+\define@key[psset]{pst-diff}{scale}{\def\psk@Diffraction@Triangle@scale{#1 }} % hauteur du triangle en m
\define@key[psset]{pst-diff}{s}{\def\psk@Diffraction@Slit@s{#1 }} % distance entre les fentes
\define@key[psset]{pst-diff}{lambda}{\pst@checknum{#1}\psk@Diffraction@Slit@Lambda }% en nm
\define@key[psset]{pst-diff}{f}{\pst@checknum{#1}\psk@Diffraction@Slit@F }% focus en m
@@ -55,13 +57,16 @@
\fi%
\edef\psk@Diffraction@Slit@contrast{\the\pst@cnta\space}}
%
+\define@boolkey[psset]{pst-diff}[Pst@Diffraction@]{showFunc}[true]{}
+\define@boolkey[psset]{pst-diff}[Pst@Diffraction@]{IIID}[true]{}
\define@boolkey[psset]{pst-diff}[Pst@Diffraction@Circular@]{twoHole}[true]{}
\define@boolkey[psset]{pst-diff}[Pst@Diffraction@Rectangular@]{twoSlit}[true]{}
%
\psset[pst-diff]{a=0.2e-3,f=5,k=1,r=1e-3,
d=6e-3,s=12e-3,h=0.5e-3,
lambda=650,pixel=0.5,
- contrast=38,gamma=0.8,twoHole=false,twoSlit=false,colorMode=3}
+ contrast=38,gamma=0.8,twoHole=false,twoSlit=false,colorMode=3, scale=1,
+ IIID=false, showFunc=false}
%
% load the pstricks-add.pro only, if not already done
\ifx\PSTricksAddLoaded\endinput\else\pstheader{pstricks-add.pro}\fi
@@ -88,17 +93,28 @@
% +- 4 fois le premier minimum
/bornexpt 1 widthSlit div focus mul ondeLongueur mul 2845 mul def
/borneypt 1 heightSlit div focus mul ondeLongueur mul 2845 mul def
+ \ifPst@Diffraction@IIID
+ \psk@ThreeDplot@zMax dup \tx@ScreenCoor pop /zScale ED
+ tx@3DPlotDict begin \variablesIIID end
+ \fi
% Les calculs commencent...
- borneypt 4 mul neg pixel 4 borneypt mul {
- /ordonneept exch def
+ /yEnd borneypt 4 mul def
+ yEnd neg pixel yEnd {
+ /ordonneept ED
% y en m
/ordonnee ordonneept 2845 div def
/argumenty ordonnee heightSlit mul ondeLongueur div focus div def
/argumentyRad argumenty Pi mul def
/argumentyDeg argumenty 180 mul def
- /sincy argumentyRad 0 eq {1}{argumentyDeg sin argumentyRad div} ifelse def
- bornexpt 4 mul neg pixel 4 bornexpt mul {
- /abscissept exch def
+ /sincy argumentyRad 0 eq { 1 }{ argumentyDeg sin argumentyRad div } ifelse def
+ /xEnd bornexpt 4 mul def
+ /OldIntensity 0 def
+ xEnd neg pixel xEnd {
+ /abscissept ED
+ \ifPst@Diffraction@IIID
+ abscissept pixel sub ordonneept OldIntensity
+ tx@3DPlotDict begin Conv3D2D end moveto
+ \fi % go to first point
% x en m
/abscisse abscissept 2845 div def
/argumentx abscisse widthSlit mul ondeLongueur div focus div def
@@ -107,11 +123,12 @@
/argumentxDeg argumentx 180 mul def
/argumentcosxDeg argumentcosx 180 mul def
% sinus cardinal
- /sincx argumentxRad 0 eq {1} { argumentxDeg sin argumentxRad div } ifelse def
+ /sincx argumentxRad 0 eq { 1 } { argumentxDeg sin argumentxRad div } ifelse def
%
1 1e\psk@Diffraction@Slit@contrast sincx dup mul sincy dup mul
\ifPst@Diffraction@Rectangular@twoSlit mul argumentcosxDeg cos dup mul \fi
- mul neg exp sub
+ mul neg exp sub dup
+ /intensity ED
dup dup Red mul 3 -1 roll Green mul 3 -1 roll Blue mul
\ifcase\psk@Diffraction@colorMode
\tx@RGBtoGRAY neg 1 add setgray \or
@@ -121,11 +138,18 @@
%
% newpath abscissept ordonneept 1 0 360 arc closepath fill stroke
% 30 juillet 2004
- newpath
- abscissept pixel 2 div sub ordonneept pixel 2 div sub moveto
- pixel 0 rlineto
- 0 pixel rlineto
- pixel neg 0 rlineto closepath fill stroke
+ \ifPst@Diffraction@IIID
+ abscissept ordonneept intensity zScale mul tx@3DPlotDict begin Conv3D2D end
+ lineto stroke % draw line in specific color
+ /OldIntensity intensity def
+ \else
+% newpath % done by stroke
+ abscissept pixel 2 div sub ordonneept pixel 2 div sub
+ moveto
+ pixel 0 rlineto
+ 0 pixel rlineto
+ pixel neg 0 rlineto closepath fill stroke
+ \fi
} for
} for
}% \addto@pscode
@@ -145,6 +169,10 @@
/d \psk@Diffraction@Circular@d def
\psk@Diffraction@Slit@Lambda tx@addDict begin wavelengthToRGB Red Green Blue end
/Blue ED /Green ED /Red ED
+ \ifPst@Diffraction@IIID
+ \psk@ThreeDplot@zMax dup \tx@ScreenCoor pop /zScale ED
+ tx@3DPlotDict begin \variablesIIID end
+ \fi
% 0 0 translate
%% Handbook of mathematical functions
%% ED. M.ABRAMOWITZ & I.A. STEGUN
@@ -204,29 +232,29 @@
% 05 08 2004
\ifPst@Diffraction@Circular@twoHole
R_limite 10 ge { /R_limite 10 def } if
- newpath
- R_limite neg 1.2 mul cm dup moveto
- R_limite 2.4 mul cm 0 rlineto
- 0 R_limite 2.4 mul cm rlineto
- R_limite neg 2.4 mul cm 0 rlineto
- closepath
- \ifnum\psk@Diffraction@colorMode=\z@ 1 \else 0 \fi
- setgray fill
+% newpath
+% R_limite neg 1.2 mul cm dup moveto
+% R_limite 2.4 mul cm 0 rlineto
+% 0 R_limite 2.4 mul cm rlineto
+% R_limite neg 2.4 mul cm 0 rlineto
+% closepath
+% \ifnum\psk@Diffraction@colorMode=\z@ 1 \else 0 \fi
+% setgray fill
R_limite neg cm 1 R_limite cm {
/xPts exch def
/x { xPts 2845 div } bind def
+ /OldIntensity 0 def
R_limite neg cm 1 R_limite cm {
/yPts exch def
+ \ifPst@Diffraction@IIID
+ xPts 1 sub yPts OldIntensity
+ tx@3DPlotDict begin Conv3D2D end moveto
+ \fi % go to first point
/y { yPts 2845 div } bind def
/R { x dup mul y dup mul add sqrt } bind def % R en m
/m Coeff R mul def
- newpath
- xPts 0.5 sub yPts 0.5 sub moveto
- 1 0 rlineto
- 0 1 rlineto
- 1 neg 0 rlineto
- closepath fill
1 1e38 m J1Card Facteur x mul cos dup mul mul neg exp sub
+ dup /intensity ED
dup dup
Red mul 3 -1 roll
Green mul 3 -1 roll
@@ -236,33 +264,76 @@
\tx@RGBtoGRAY setgray \or
\tx@RGBtoCMYK setcmykcolor
\else setrgbcolor \fi
- stroke
+ \ifPst@Diffraction@IIID
+ xPts yPts intensity zScale mul tx@3DPlotDict begin Conv3D2D end
+ lineto stroke % draw line in specific color
+ /OldIntensity intensity def
+ \else
+ xPts 0.5 sub yPts 0.5 sub moveto
+ 1 0 rlineto
+ 0 1 rlineto
+ 1 neg 0 rlineto
+ closepath fill
+ stroke
+ \fi
} for
} for
%
- \else
- newpath
- R_limite neg 1.5 mul cm dup moveto
- R_limite 3 mul cm 0 rlineto
- 0 R_limite 3 mul cm rlineto
- R_limite neg 3 mul cm 0 rlineto
- closepath
- \ifnum\psk@Diffraction@colorMode=\z@ 1 \else 0 \fi setgray fill
- 0 0.01 R_limite {
- /Rayon exch def
- /m Coeff Rayon 0.01 mul mul def
+ \else % only one circular hole
+ \ifPst@Diffraction@IIID \else
newpath
- 0 0 Rayon cm 0 360 arc
- 1 1e38 m J1Card neg exp sub Red mul % R
- 1 1e38 m J1Card neg exp sub Green mul % G
- 1 1e38 m J1Card neg exp sub Blue mul % B
+ R_limite neg %1.5 mul
+ cm dup moveto
+ R_limite 2 mul cm 0 rlineto
+ 0 R_limite 2 mul cm rlineto
+ R_limite neg 2 mul cm 0 rlineto
+ closepath
+ \fi
+ \ifnum\psk@Diffraction@colorMode=\z@ 1 \else 0 \fi setgray fill
+ /intensityOld 0 def
+ R_limite -0.001 0 {
+ /Radius exch def
+ /m Coeff Radius 0.01 mul mul def
+ 1 1e38 m J1Card neg exp sub
+ dup /intensity ED
+ dup dup
+ Red mul 3 -1 roll % R
+ Green mul 3 -1 roll % G
+ Blue mul % B
\ifcase\psk@Diffraction@colorMode
\tx@RGBtoGRAY neg 1 add setgray \or
\tx@RGBtoGRAY setgray \or
\tx@RGBtoCMYK setcmykcolor
\else setrgbcolor \fi
- stroke
+ \ifPst@Diffraction@IIID
+% Radius cm 0 intensity zScale mul tx@3DPlotDict begin Conv3D2D end moveto
+ /notFilled true def
+ 0.1 setlinewidth
+ intensity intensityOld gt {
+ 0 1 360 {
+ /angle ED
+ Radius cm angle cos mul Radius cm angle sin mul intensity zScale mul
+ tx@3DPlotDict begin Conv3D2D end
+ angle 0 eq { moveto }{ lineto } ifelse % draw line in specific color
+ } for
+ notFilled { closepath fill /notFilled false def } if
+ stroke
+ /intensityOld intensity def
+ }{
+ 0 1 360 {
+ /angle ED
+ Radius cm angle cos mul Radius cm angle sin mul intensityOld zScale mul
+ tx@3DPlotDict begin Conv3D2D end
+ angle 0 eq { moveto }{ lineto } ifelse % draw line in specific color
+ } for
+ closepath stroke
+ } ifelse % intensity intensityOld gt
+ \else
+ 0 0 Radius cm 0 360 arc
+ stroke
+ \fi
} for
+ \ifPst@Diffraction@showFunc
newpath
0 0 moveto
R_limite 1.5 mul cm 0 rlineto
@@ -274,9 +345,9 @@
newpath
0 0 J1Card 1000 mul moveto
0 0.01 R_limite {
- /Rayon exch def
- /m Coeff Rayon 0.01 mul mul def
- Rayon cm m J1Card 1000 mul lineto
+ /Radius exch def
+ /m Coeff Radius 0.01 mul mul def
+ Radius cm m J1Card 1000 mul lineto
} for
\ifnum\psk@Diffraction@colorMode=\z@ 1 \else 0 \fi setgray
\pst@number\pslinewidth setlinewidth
@@ -311,6 +382,7 @@
newpath
grille
\fi
+ \fi
}% \addto@pscode
\end@SpecialObj%
}
@@ -335,6 +407,10 @@
% +- 4 fois le premier minimum
/bornexpt 1 h div f mul L mul 2845 mul def
/borneypt 1 h div f mul L mul 2845 mul def
+ \ifPst@Diffraction@IIID
+ \psk@ThreeDplot@zMax dup \tx@ScreenCoor pop /zScale ED
+ tx@3DPlotDict begin \variablesIIID end
+ \fi
/P {
1 k y mul x p y mul sub mul div
1 k h mul x p y mul sub mul RadtoDeg cos sub
@@ -354,18 +430,24 @@
/I { P dup mul Q dup mul add } def
/I_max 0 store
% Les calculs commencent...
- borneypt 4 mul neg pixel 4 borneypt mul {
+ borneypt 4 mul \psk@Diffraction@Triangle@scale mul dup neg pixel 3 -1 roll {
/ordonneept exch def
% y en m
/y ordonneept 2845 div def
- bornexpt 4 mul neg pixel 4 bornexpt mul {
+ /OldIntensity 0 def
+ bornexpt 4 mul \psk@Diffraction@Triangle@scale mul dup neg pixel 3 -1 roll {
/abscissept exch def
+ \ifPst@Diffraction@IIID
+ abscissept ordonneept OldIntensity
+ tx@3DPlotDict begin Conv3D2D end moveto
+ \fi % go to first point
% x en m
/x abscissept 2845 div def
I_max I le { /I_max I def } if
%
1.05 1e\psk@Diffraction@Slit@contrast I neg exp sub
- dup dup
+ dup /intensity ED
+ dup dup
Red mul 3 -1 roll Green mul 3 -1 roll Blue mul
\ifcase\psk@Diffraction@colorMode
\tx@RGBtoGRAY neg 1 add setgray \or
@@ -373,10 +455,16 @@
\tx@RGBtoCMYK setcmykcolor
\else setrgbcolor \fi
%
- newpath abscissept pixel 2 div sub ordonneept pixel 2 div sub moveto
- pixel 0 rlineto
- 0 pixel rlineto
- pixel neg 0 rlineto closepath fill stroke
+ \ifPst@Diffraction@IIID
+ abscissept ordonneept intensity zScale mul tx@3DPlotDict begin Conv3D2D end
+ lineto stroke % draw line in specific color
+ /OldIntensity intensity def
+ \else
+ newpath abscissept pixel 2 div sub ordonneept pixel 2 div sub moveto
+ pixel 0 rlineto
+ 0 pixel rlineto
+ pixel neg 0 rlineto closepath fill stroke
+ \fi
} for
} for
}% addto@pscode