diff options
author | Karl Berry <karl@freefriends.org> | 2008-06-18 18:34:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-06-18 18:34:46 +0000 |
commit | a63b3cf004ff93cac025d38a450b9e383a16e044 (patch) | |
tree | 222aa79ff0c547ca82761198059a83695c1c256b /Master/texmf-dist/tex/generic/pst-optexp | |
parent | 47c3018e28d4f17ef2156f9866d0d012e8c0567e (diff) |
pst-optexp update (17jun08)
git-svn-id: svn://tug.org/texlive/trunk@8843 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-optexp')
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex | 1278 |
1 files changed, 702 insertions, 576 deletions
diff --git a/Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex b/Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex index 3c110bf6a61..6d7b5fe5bcc 100644 --- a/Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex +++ b/Master/texmf-dist/tex/generic/pst-optexp/pst-optexp.tex @@ -20,14 +20,14 @@ \let\PSToptexpLoaded\endinput % % -\def\fileversion{1.1} -\def\filedate{2007/09/06} +\def\fileversion{1.2} +\def\filedate{2008/06/17} \message{`pst-optexp' v\fileversion, \filedate\space (CB)} % -% DPC interface to the `keyval' package (until keyval based version of PSTricks) -% \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax \pst@addfams{optexp} +\pstheader{pst-optexp.pro} +\def\pst@optexpdict{tx@OptexpDict begin } \SpecialCoor % % In some versions of pstricks-add previous to 2.81 the macro @@ -51,7 +51,7 @@ /angle dy dx Atan def /linelength \pst@number\pst@dimp \pst@number\psunit div def XA linelength angle cos mul add YA linelength angle sin mul add ){#4}% -} +}% \def\nlput{\pst@object{nlput}} \def\nlput@i(#1)(#2)#3#4{% \begin@SpecialObj @@ -61,6 +61,7 @@ \end@SpecialObj }% \fi +% % IF's % \newif\ifPst@optexp@variable @@ -71,39 +72,40 @@ \newif\ifPst@optexp@component@optional \newif\ifPst@optexp@debug@showoptdots \newif\ifPst@optexp@endbox +\newif\ifPst@optexp@thicklens % % Strings -\edef\pst@string@pol@polperp{perp} -\edef\pst@string@pol@polparallel{parallel} -\edef\pst@string@pol@polmisc{misc} -\edef\pst@string@pol@polrcirc{rcirc} -\edef\pst@string@pol@pollcirc{lcirc} -\edef\pst@string@mirror@type@piezo{piezo} -\edef\pst@string@mirror@type@plain{plain} -\edef\pst@string@mirror@type@extended{extended} -% -\edef\pst@string@lens@type@plainconvex{plainconvex} -\edef\pst@string@lens@type@convexplain{convexplain} -\edef\pst@string@lens@type@biconvex{biconvex} -\edef\pst@string@lens@type@plainconcave{plainconcave} -\edef\pst@string@lens@type@concaveplain{concaveplain} -\edef\pst@string@lens@type@biconcave{biconcave} -% -\edef\pst@string@labelref@relative{relative} -\edef\pst@string@labelref@relgrav{relgrav} -\edef\pst@string@labelref@global{global} -% -\edef\pst@optexp@label@refangle{0} -% +\def\pst@string@pol@polperp{perp} +\def\pst@string@pol@polparallel{parallel} +\def\pst@string@pol@polmisc{misc} +\def\pst@string@pol@polrcirc{rcirc} +\def\pst@string@pol@pollcirc{lcirc} +\def\pst@string@mirror@type@piezo{piezo} +\def\pst@string@mirror@type@plain{plain} +\def\pst@string@mirror@type@extended{extended} +\def\pst@string@optgrid@type@blazed{blazed} +\def\pst@string@optgrid@type@binary{binary} +% +\def\pst@string@lens@type@plainconvex{plainconvex} +\def\pst@string@lens@type@convexplain{convexplain} +\def\pst@string@lens@type@biconvex{biconvex} +\def\pst@string@lens@type@plainconcave{plainconcave} +\def\pst@string@lens@type@concaveplain{concaveplain} +\def\pst@string@lens@type@biconcave{biconcave} +% +\def\pst@string@labelref@relative{relative} +\def\pst@string@labelref@relgrav{relgrav} +\def\pst@string@labelref@global{global} % % psstyles % -\newpsstyle{OptionalStyle}{linestyle=dashed,dash=1.5pt 1pt} +\newpsstyle{OptionalStyle}{linestyle=dashed,dash=1.5pt 1pt}% \newpsstyle{ExtendedMirror}{linestyle=none,% hatchwidth=0.5\psk@optexp@mirror@linewidth,%0.6pt,% hatchsep=1.4\psk@optexp@mirror@linewidth,% - fillstyle=hlines} -\newpsstyle{PiezoMirror}{fillstyle=solid,fillcolor=black!30} + fillstyle=hlines}% +\newpsstyle{PiezoMirror}{fillstyle=solid,fillcolor=black!30}% +\newpsstyle{OptBeam}{linecolor=green!90!black}% % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -119,8 +121,15 @@ % Lens \define@key[psset]{optexp}{lensheight}{\edef\psk@optexp@lens@height{#1}} \define@key[psset]{optexp}{lenswidth}{\edef\psk@optexp@lens@width{#1}} -\define@key[psset]{optexp}{lensradius}{\edef\psk@optexp@lens@radius{#1}} -% Lens Type +\define@key[psset]{optexp}{lensradiusleft}{\edef\psk@optexp@lens@radiusLeft{#1}} +\define@key[psset]{optexp}{lensradiusright}{\edef\psk@optexp@lens@radiusRight{#1}} +\define@boolkey[psset]{optexp}[Pst@optexp@]{thicklens}[true]{} +\define@key[psset]{optexp}{lensradius}{% + \psset{lensradiusleft=#1,% + lensradiusright=#1}% + \edef\psk@optexp@lens@radius{#1}% +}% +% Lens Type (only for backward compatibility) % 0 -> plainconvex % 1 -> convexplain % 2 -> biconvex @@ -139,6 +148,26 @@ \ifx\pst@string@lens@type@biconcave\pst@tempA 5% \fi\fi\fi\fi\fi\fi% }} +\define@key[psset]{optexp}{lens}{% + \pst@expandafter\psset@@lens{#1} {} {} {} {} {}\@nil +}% +\def\psset@@lens#1 #2 #3 #4 #5\@nil{% + \edef\pst@temp{#4}% + \ifx\pst@temp\@empty\else + \psset{lenswidth=#4}% + \fi + \edef\pst@temp{#3}% + \ifx\pst@temp\@empty\else + \psset{lensheight=#3} + \fi + \edef\pst@temp{#2}% + \ifx\pst@temp\@empty + \psset{lensradiusright=#1}% + \else + \psset{lensradiusright=#2}% + \fi + \psset{lensradiusleft=#1}% +}% % % Pinhole \define@key[psset]{optexp}{innerheight}{\edef\psk@optexp@pinhole@iheight{#1}} @@ -174,12 +203,14 @@ \define@key[psset]{optexp}{mirrorlinewidth}{\edef\psk@optexp@mirror@linewidth{#1}} \define@key[psset]{optexp}{mirrortype}{\edef\psk@optexp@mirror@type{#1}}% piezo, extended, plain \define@key[psset]{optexp}{mirrordepth}{\edef\psk@optexp@mirror@depth{#1}} +\define@key[psset]{optexp}{mirrorradius}{\edef\psk@optexp@mirror@radius{#1}} \define@boolkey[psset]{optexp}[Pst@optexp@]{variable}[true]{} % % Grid \define@key[psset]{optexp}{optgridcount}{\edef\psk@optexp@optgrid@count{#1}} \define@key[psset]{optexp}{optgridwidth}{\edef\psk@optexp@optgrid@width{#1}} \define@key[psset]{optexp}{optgridheight}{\edef\psk@optexp@optgrid@height{#1}} +\define@key[psset]{optexp}{optgridtype}{\edef\psk@optexp@optgrid@type{#1}} \define@key[psset]{optexp}{optgriddepth}{\edef\psk@optexp@optgrid@depth{#1}} \define@key[psset]{optexp}{optgridlinewidth}{\edef\psk@optexp@optgrid@linewidth{#1}} \define@boolkey[psset]{optexp}[Pst@optexp@]{reverse}[true]{} @@ -218,6 +249,8 @@ \define@key[psset]{optexp}{labelstyle}{\def\psk@optexp@label@style{#1}} \define@key[psset]{optexp}{labelalign}{\def\psk@optexp@label@align{#1}} \define@key[psset]{optexp}{labelref}{\edef\psk@optexp@label@ref{#1}} +% for internal use only +\define@key[psset]{optexp}{ref@angle}{\edef\psk@optexp@label@refangle{#1}} % labelrelative is obsolete \define@choicekey*[psset]{optexp}{labelrelative}[\val\nr]{true,false}[true]{% \ifcase\nr\relax @@ -227,7 +260,6 @@ \fi \PackageWarning{pst-optexp}{labelrelative is obsolete, please use labelref=relative instead} } - % % Debug \define@boolkey[psset]{optexp}[Pst@optexp@debug@]{showoptdots}[true]{} @@ -235,89 +267,111 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% Makros +% BASIC MACROS % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\lens{\@ifnextchar[{\pst@lens}{\pst@lens[]}} -\def\pinhole{\@ifnextchar[{\pst@pinhole}{\pst@pinhole[]}} -\def\beamsplitter{\@ifnextchar[{\pst@beamsplitter}{\pst@beamsplitter[]}} -\def\crystal{\@ifnextchar[{\pst@crystal}{\pst@crystal[]}} -\def\optgrid{\@ifnextchar[{\pst@optgrid}{\pst@optgrid[]}} -\def\mirror{\@ifnextchar[{\pst@mirror}{\pst@mirror[]}} -\def\polarisation{% - \PackageWarning{pst-optexp}{macro polarisation is obsolete, please use polarization instead}% - \@ifnextchar[{\pst@polarization}{\pst@polarization[]}% -} -\def\polarization{\@ifnextchar[{\pst@polarization}{\pst@polarization[]}} -\def\optbox{\@ifnextchar[{\pst@optbox}{\pst@optbox[]}} -\def\optplate{\@ifnextchar[{\pst@optplate}{\pst@optplate[]}} -\def\optretplate{\@ifnextchar[{\pst@optretplate}{\pst@optretplate[]}} -\def\detector{\@ifnextchar[{\pst@detector}{\pst@detector[]}} -\def\optdipole{\@ifnextchar[{\pst@optdipole}{\pst@optdipole[]}} -\def\opttripole{\@ifnextchar[{\pst@opttripole}{\pst@opttripole[]}} -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Command analog to addbefore@par which is defined in pstricks.tex +% addafter@par inserts new options at the _end_ of the current token register. +% This can be useful to preset options that are not allowed to be changed by the +% user. % -% default settings -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\psset{% - angle=0 - ,lenswidth=0.2 - ,lensheight=1 - ,lenstype=biconvex - ,mirrorwidth=1 - ,mirrordepth=0.08 - ,poltype=\pst@string@pol@polparallel - ,optgridcount=10 - ,optgridwidth=1 - ,optgridheight=0.1 - ,optgriddepth=0.05 - ,bssize=0.8 - ,outerheight=1 - ,innerheight=0.1 - ,crystalwidth=2 - ,crystalheight=0.8 - ,caxislength=0.6 - ,optboxwidth=1 - ,optboxheight=0.5 - ,position=\@empty - ,abspos=\@empty - ,labeloffset=0.8 - ,labelangle=0 - ,labelstyle=\small - ,mirrortype=\pst@string@mirror@type@plain, - ,labelalign=c - ,lensradius=\@empty - ,mirrorlinewidth=2\pslinewidth - ,plateheight=1 - ,platelinewidth=2\pslinewidth - ,platewidth=0.1 - ,polsize=0.6 - ,pollinewidth=0.7\pslinewidth - ,optgridlinewidth=0.7\pslinewidth - ,phlinewidth=2\pslinewidth - ,lampscale=0.3 - ,detsize=0.5 - ,labelref=relgrav -}% -% -% -% -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Macro implementations +\def\addafter@par#1{% + \ifx\pst@par\@empty + \def\pst@par{#1}% + \else + \toks@{#1}% + \pst@toks\expandafter{\pst@par}% + \edef\pst@par{\the\pst@toks,\the\toks@}% + \fi% +} % +% New high-level macros +% 1) Allow a compressed notation of all provided elements, as most of the organizing code +% is mostly equal. +% +% 2) Provide a rather easy-to-use interface for the user to allow new user-defined elements +% +\def\newOptexpDipole{\@ifnextchar[{\new@optexpdipole}{\new@optexpdipole[]}} +\def\newOptexpDipoleNolabel{\@ifnextchar[{\new@optexpdipolenolabel}{\new@optexpdipolenolabel[]}} +\def\newOptexpTripole{\@ifnextchar[{\new@optexptripole}{\new@optexptripole[]}} +% +% Creates new macros ...@i and ...@ii which provide most code for the arrangement +% of the objects. A tempNode@Label is predefined as well as two internal nodes if compname is +% defined. +% ...@iii must be defined manually and should contain all the stroking code +\def\new@optexpdipole[#1]#2#3{% + \@ifundefined{#2@i}{% + \@namedef{#2}{\pst@object{#2}}% + \expandafter\def\csname #2@i\endcsname(##1)(##2)##3{% + \pst@killglue + \addbefore@par{#3}% + \addafter@par{#1}% + \begingroup + \use@par + \pst@regNodes{##1}{##2} + \pst@draw@component{##3}{\@nameuse{#2@ii}} + \endgroup + }% + \@namedef{#2@ii}{% + \pnode(0,0){tempNode@Label}% + \@nameuse{#2@iii}% + }% + }{% + \@pstrickserr{OptExp dipole object `#2' already defined}\@eha}% +\ignorespaces}% +% +% Equivalent to new@optexdipole, only that objects without labels are created. +\def\new@optexpdipolenolabel[#1]#2#3{% + \@ifundefined{#2@i}{% + \@namedef{#2}{\pst@object{#2}}% + \expandafter\def\csname #2@i\endcsname(##1)(##2){% + \pst@killglue + \addbefore@par{#3}% + \addafter@par{#1}% + \begingroup + \use@par + \pst@regNodes{##1}{##2} + \pst@draw@component{}{\@nameuse{#2@ii}} + \endgroup + }% + \@namedef{#2@ii}{% + \pnode(0,0){tempNode@Label}% + \@nameuse{#2@iii}% + }% + }{% + \@pstrickserr{OptExp dipole object `#2' already defined}\@eha}% +\ignorespaces}% +% +% Equivalent to new@optexpdipole for tripole objects. +\def\new@optexptripole[#1]#2#3{% + \@ifundefined{#2@i}{% + \@namedef{#2}{\pst@object{#2}}% + \expandafter\def\csname #2@i\endcsname(##1)(##2)(##3)##4{% + \pst@killglue + \addbefore@par{#3}% + \addafter@par{ref@angle=180,#1}% + \begingroup + \use@par + \pst@calcNodes{##1}{##2}{##3} + \pst@draw@component{##4}{\@nameuse{#2@ii}} + \endgroup + }% + \@namedef{#2@ii}{% + \pnode(0,0){tempNode@Label}% + \@nameuse{#2@iii}% + }% + }{% + \@pstrickserr{OptExp tripole object `#2' already defined}\@eha}% +\ignorespaces}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Some of the components need three points to be positioned. % These are: % -% 1. startpoint of the beam (in the PS-Code: (XA,YA)) -% 2. reflectionpoint on the surface (XG, YG) -% 3. endpoint (XB,YB) +% 1. starting point of the beam (in the PS-Code: (XA,YA)) +% 2. reflection point on the surface (XG, YG) +% 3. end point (XB,YB) % % With these three points \pst@calcNodes calculates two new points 'tempNode@A' % and 'tempNode@B', between which the component is placed by the macro @@ -330,71 +384,24 @@ \pst@getcoor{#2}\pst@tempb% \pst@getcoor{#3}\pst@tempc% \pnode(!% - \pst@tempa /YA exch \pst@number\psyunit div def - /XA exch \pst@number\psxunit div def - \pst@tempb /YG exch \pst@number\psyunit div def - /XG exch \pst@number\psxunit div def - \pst@tempc /YB exch \pst@number\psyunit div def - /XB exch \pst@number\psxunit div def - /ax XG XA sub def - /ay YG YA sub def - /bx XB XG sub def - /by YB YG sub def - /a ax 2 exp ay 2 exp add sqrt def - /b bx 2 exp by 2 exp add sqrt def - /cx ax a div bx b div add def - /cy ay a div by b div add def - /c cx 2 exp cy 2 exp add sqrt def - % - % if c=0, then set the coordinates of the vector manually - % depending on the dotproduct (and thus, if 'a' and 'b' - % are parallel or antiparallel - c 0 eq - {/dotprod ax bx mul ay by mul add def - dotprod 0 gt - % if dotprod > 0 then a and b are parallel - {/cx ax def - /cy ay def} - % else a and b are antiparallel - {/cx ay def - /cy ax neg def} ifelse - /c a def - }if - /X@A XG cx c div add def - /Y@A YG cy c div add def - /X@B XG cx c div sub def - /Y@B YG cy c div sub def - % - % chirality: - % test the order of the input points as a input angle > 90° - % doesn't really make sens. - % So if 'chir' <= 0 exchange the calculated coordinates of - % A and B and otherwise leave it as is - /chir ax by mul ay bx mul sub def - chir 0 le - {/XAtmp X@A def - /YAtmp Y@A def - /X@A X@B def - /Y@A Y@B def - /X@B XAtmp def - /Y@B YAtmp def}if - X@A Y@A){tempNode@A}% - \pnode(! X@B Y@B){tempNode@B}% - \gdef\pst@optexp@label@refangle{180} + \pst@optexpdict + \pst@tempa \pst@number\psyunit div exch \pst@number\psxunit div exch + \pst@tempc \pst@number\psyunit div exch \pst@number\psxunit div exch + \pst@tempb \pst@number\psyunit div exch \pst@number\psxunit div exch + calcNodes + X@A Y@A end){tempNode@A}% + \pnode(! \pst@optexpdict X@B Y@B end){tempNode@B}% }\ignorespaces}% % % -% If a macro requests only two points, they are equivalent to +% If a macro needs only two points, they are equivalent to % 'tempNode@A' and 'tempNode@B'. But for easier implementation of other -% macros the given points are assigned to the temporary nodes. In -% addition \pst@regNodes defines the x- and the y-coordinate of the two -% inputpoints (XA,YA) (XB,YB) in PS-Code -% +% macros the given points are assigned to the temporary nodes. % -\def\pst@regNodes#1#2{{% +\def\pst@regNodes#1#2{% \pnode(#1){tempNode@A} \pnode(#2){tempNode@B} -}\ignorespaces}% +\ignorespaces}% % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -404,154 +411,231 @@ % Define a new node #3 shifted by (#1) relative to existing node #2. % Aditionally rotate the new node by #4 degree around existing node as origin. % -\def\pst@defShiftedRotNode(#1)#2#3#4{% +\def\pst@defShiftedRotLabelNode(#1)#2#3#4{% \pst@getcoor{#1}\pst@tempDiff% \pnode(!% \pst@tempDiff /YDiff ED /XDiff ED % - tx@NodeDict begin /N@#2 load GetCenter /YShifted ED /XShifted ED - /rot@angle #4 \pst@optexp@label@refangle\space add def + /rot@angle #4 \psk@optexp@label@refangle\space add def /XDiff@Rot rot@angle cos XDiff mul rot@angle sin YDiff mul add def /YDiff@Rot rot@angle cos YDiff mul rot@angle sin XDiff mul sub def XShifted XDiff@Rot add \pst@number\psxunit div YShifted YDiff@Rot add \pst@number\psyunit div neg - end){#3}% + ){#3}% % reset reference label to 0 - \gdef\pst@optexp@label@refangle{0}% + \psset{ref@angle=0} }% % -% Define a new node #3 that is only shifted by (#1) with respect to the existing -% node #2 -\def\pst@defShiftedNode(#1)#2#3{% - \pst@defShiftedRotNode(#1){#2}{#3}{0}% +% Define a new node #3 that is shifted by (#1) +% with respect to the existing node #2 +\def\pst@defShiftedLabelNode(#1)#2#3{% + \pst@defShiftedRotLabelNode(#1){#2}{#3}{0}% }% % % Used to put the label for labelref=relative % \def\put@RelLabel#1{% -\nput[labelsep=0]{\psk@optexp@label@angle}% - {tempNode@LabelShifted}% - {\rput[\psk@optexp@label@align](0,0){\psk@optexp@label@style #1}}% + \nput[labelsep=0]{\psk@optexp@label@angle}% + {tempNode@LabelShifted}% + {\rput[\psk@optexp@label@align](0,0){\psk@optexp@label@style #1}}% }% % -% Put the component #1 and define a new node 'tempNode@LabelShifted' +% Place the component in argument #1 and define a new node 'tempNode@LabelShifted' % for positioning of the label \def\put@Comp#1{% #1% - \pst@defShiftedRotNode(0,\psk@optexp@label@offset)% + \pst@defShiftedRotLabelNode(0,\psk@optexp@label@offset)% {tempNode@Label}% {tempNode@LabelShifted}% {\psk@optexp@label@angle}% }% % +% Positioning of the label depending on the reference coordinates. +% Needs possibly a previously defined node tempNode@LabelShifted which +% marks exactly the position of the label relative to the component. +% This is defined by calling \put@Comp. +% +% Parameter 'labelref' which sets the reference coordinates can have +% the values +% global => labelangle rotates the label origin in global coordinate +% system, text is not rotated +% relgrav => labelangle rotates the label origin relativ to the local +% coordinate system of the component, text is not rotated +% relative => as relgrav but text is rotated together with object. +% +\def\put@Label#1{% + \ifx\psk@optexp@label@ref\pst@string@labelref@global + % + % global + \nput[labelsep=\psk@optexp@label@offset]% + {\psk@optexp@label@angle}% + {tempNode@Label}% + {\rput[\psk@optexp@label@align](0,0){\psk@optexp@label@style #1}}% + % + \else\ifx\psk@optexp@label@ref\pst@string@labelref@relgrav + % + % relgrav + \rput[\psk@optexp@label@align](tempNode@LabelShifted){\psk@optexp@label@style #1}% + % + \else\ifx\psk@optexp@label@ref\pst@string@labelref@relative + % + % relative + \begingroup + % + % Redefine InitNC only for positioning of the label with + % labelref=relative + % + \pst@def{InitNC}< % kindly contributed by Herbert Voss + /b ED /a ED % second and first node + /NodeSepTypeB ED /NodeSepTypeA ED + /NodeSepB ED /NodeSepA ED + /OffsetB ED /OffsetA ED + tx@NodeDict a known tx@NodeDict b known and dup { + /NodeA a load def /NodeB b load def + NodeA GetCenter NodeB GetCenter % xA yA xB yB + 4 copy pop exch pop le % xA xB + { /yB ED /xB ED /yA ED /xA ED } + { /yA ED /xA ED /yB ED /xB ED } ifelse + } if >% + % + \ncline[linestyle=none,fillstyle=none,npos=]{tempNode@A}{tempNode@B}% + % + % + \ifx\psk@optexp@position\@empty + \ifx\psk@optexp@abspos\@empty + \ncput[nrot=:U,npos=]{\put@RelLabel{#1}} + \else + \nlput[nrot=:U](tempNode@A)(tempNode@B){\psk@optexp@abspos}{\put@RelLabel{#1}} + \fi + \else + \ncput[nrot=:U,npos=\psk@optexp@position]{\put@RelLabel{#1}} + \fi + % + \endgroup + \fi\fi\fi +}% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% COMPONENT WRAPPERS -% -\def\pst@lens[#1](#2)(#3)#4{{% - \pst@regNodes{#2}{#3}% - \pst@draw@component{#1}{#4}\pst@draw@lens% -}\ignorespaces}% -% -% -% -\def\pst@pinhole[#1](#2)(#3)#4{{% - \pst@regNodes{#2}{#3}% - \pst@draw@component{#1}{#4}\pst@draw@pinhole% -}\ignorespaces}% -% -% -% -\def\pst@mirror[#1](#2)(#3)(#4)#5{{% - \pst@calcNodes{#2}{#3}{#4}% - \pst@draw@component{#1}{#5}\pst@draw@mirror% -}\ignorespaces}% -% -% -% -\def\pst@optgrid[#1](#2)(#3)(#4)#5{{% - \pst@calcNodes{#2}{#3}{#4}% - \pst@draw@component{#1}{#5}\pst@draw@optgrid% -}\ignorespaces}% -% -% -% -\def\pst@beamsplitter[#1](#2)(#3)(#4)#5{{% - \pst@calcNodes{#2}{#3}{#4}% - \gdef\pst@optexp@label@refangle{-135} - \pst@draw@component{#1}{#5}\pst@draw@beamsplitter% -}\ignorespaces}% -% -% -% -\def\pst@crystal[#1](#2)(#3)#4{{% - \pst@regNodes{#2}{#3}% - \pst@draw@component{#1}{#4}\pst@draw@crystal% -}\ignorespaces}% -% -% -% -\def\pst@optbox[#1](#2)(#3)#4{{% - \pst@regNodes{#2}{#3}% - \pst@draw@component{#1}{#4}\pst@draw@optbox% -}\ignorespaces}% -% -% -% -\def\pst@optplate[#1](#2)(#3)#4{{% - \pst@regNodes{#2}{#3}% - \pst@draw@component{#1}{#4}\pst@draw@optplate% -}\ignorespaces}% -% -% -% -\def\pst@optretplate[#1](#2)(#3)#4{{% - \pst@regNodes{#2}{#3}% - \pst@draw@component{#1}{#4}\pst@draw@optretplate% -}\ignorespaces}% -% -% -% -\def\pst@detector[#1](#2)(#3)#4{{% - \pst@regNodes{#2}{#3}% - \psset{endbox} - \pst@draw@component{#1}{#4}\pst@draw@detector% -}\ignorespaces}% -% -% +% FREE-RAY COMPONENTS % -\def\pst@polarization[#1](#2)(#3){{% - \pst@regNodes{#2}{#3}% - \pst@draw@component{#1}{}\pst@draw@polarization% -}\ignorespaces}% +% DIPOLES % +\newOptexpDipole{lens}{}% +\newOptexpDipole{pinhole}{}% +\newOptexpDipole{crystal}{}% +\newOptexpDipoleNolabel{polarization}{}% +\newOptexpDipole{optbox}{}% +\newOptexpDipole{optplate}{}% +\newOptexpDipole{optretplate}{}% +\newOptexpDipole[endbox]{detector}{}% +\newOptexpDipole{optdipole}{}% % +% TRIPOLES % -\def\pst@optdipole[#1](#2)(#3)#4#5{{% - \pst@regNodes{#2}{#3}% - \pst@draw@component{#1}{#5}{\pnode(0,0){tempNode@Label}#4}% -}\ignorespaces}% +\newOptexpTripole{mirror}{}% +\newOptexpTripole[ref@angle=-135]{beamsplitter}{}% +\newOptexpTripole{optgrid}{}% % +% SPECIAL OBJECTS % +\def\optdipole{\pst@object{optdipole}} +\def\optdipole@i(#1)(#2)#3#4{% + \pst@killglue + \begingroup + \use@par + \pst@regNodes{#1}{#2} + \pst@draw@component{#4}{% + \pnode(0,0){tempNode@Label}% + #3 + }% + \endgroup +}% +\def\opttripole{\pst@object{opttripole}} +\def\opttripole@i(#1)(#2)(#3)#4#5{% + \pst@killglue + \begingroup + \use@par + \pst@calcNodes{#1}{#2}{#3} + \pst@draw@component{#5}{% + \pnode(0,0){tempNode@Label}% + #4 + }% + \endgroup +}% % -\def\pst@opttripole[#1](#2)(#3)(#4)#5#6{{% - \pst@calcNodes{#2}{#3}{#4}% - \pst@draw@component{#1}{#6}{\pnode(0,0){tempNode@Label}#5}% -}\ignorespaces}% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % +% default settings % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\psset{% +% general + position=\@empty + ,abspos=\@empty + ,angle=0 +% lens + ,lenswidth=0.2 + ,lensheight=1 + ,lenstype=\@empty + ,lensradius=\@empty + ,lensradiusleft=1 + ,lensradiusright=1 +% pinhole + ,phlinewidth=2\pslinewidth + ,outerheight=1 + ,innerheight=0.1 +% beamsplitter + ,bssize=0.8 +% crystal + ,crystalwidth=2 + ,crystalheight=0.8 + ,caxislength=0.6 + ,lampscale=0.3 +% mirror + ,mirrorwidth=1 + ,mirrordepth=0.08 + ,mirrorradius=0 + ,mirrortype=\pst@string@mirror@type@plain + ,mirrorlinewidth=2\pslinewidth +% optgrid + ,optgridcount=10 + ,optgridwidth=1 + ,optgridheight=0.1 + ,optgriddepth=0.05 + ,optgridtype=\pst@string@optgrid@type@blazed + ,optgridlinewidth=0.7\pslinewidth +% optbox + ,optboxwidth=1 + ,optboxheight=0.5 +% optplate + ,plateheight=1 + ,platelinewidth=2\pslinewidth +% optretplate + ,platewidth=0.1 +% detector + ,detsize=0.5 +% polarization + ,poltype=\pst@string@pol@polparallel + ,polsize=0.6 + ,pollinewidth=0.7\pslinewidth +% label + ,labeloffset=0.8 + ,labelangle=0 + ,labelstyle=\small + ,labelalign=c + ,labelref=relgrav + ,ref@angle=0 +}% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DRAW COMPONENTS % % This macro is called by every unit % -\def\pst@draw@component#1#2#3{{% -% \psset{labelsep=1}% - \psset{#1}% +\def\pst@draw@component#1#2{% % \ifPst@optexp@endbox% \ifx\psk@optexp@label@offset\@empty @@ -575,184 +659,251 @@ % % then check if absolute positioning is wanted \ifx\psk@optexp@abspos\@empty - \ncput[nrot=:U,npos=]{\put@Comp{#3}} + \ncput[nrot=:U,npos=]{\put@Comp{#2}} \else - \nlput[nrot=:U](tempNode@A)(tempNode@B){\psk@optexp@abspos}{\put@Comp{#3}} + \nlput[nrot=:U](tempNode@A)(tempNode@B){\psk@optexp@abspos}{\put@Comp{#2}} \fi \else - \ncput[nrot=:U,npos=\psk@optexp@position]{\put@Comp{#3}} + \ncput[nrot=:U,npos=\psk@optexp@position]{\put@Comp{#2}} \fi - % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % - % Positioning of the label depending on the reference coordinates - % - \ifx\psk@optexp@label@ref\pst@string@labelref@global - % global - \nput[labelsep=\psk@optexp@label@offset]% - {\psk@optexp@label@angle}% - {tempNode@Label}% - {\rput[\psk@optexp@label@align](0,0){\psk@optexp@label@style #2}}% - \else\ifx\psk@optexp@label@ref\pst@string@labelref@relgrav - \rput[\psk@optexp@label@align](tempNode@LabelShifted){\psk@optexp@label@style #2} - \else\ifx\psk@optexp@label@ref\pst@string@labelref@relative - \begingroup - % - % Redefine InitNC only for positioning of the label with - % labelref=relative - % - \pst@def{InitNC}< % kindly contributed by Herbert Voss - /b ED /a ED % second and first node - /NodeSepTypeB ED /NodeSepTypeA ED - /NodeSepB ED /NodeSepA ED - /OffsetB ED /OffsetA ED - tx@NodeDict a known tx@NodeDict b known and dup { - /NodeA a load def /NodeB b load def - NodeA GetCenter NodeB GetCenter % xA yA xB yB - 4 copy pop exch pop le % xA xB - { /yB ED /xB ED /yA ED /xA ED } - { /yA ED /xA ED /yB ED /xB ED } ifelse - } if >% - % - \ncline[linestyle=none,fillstyle=none,npos=]{tempNode@A}{tempNode@B}% - % - % - \ifx\psk@optexp@position\@empty - \ifx\psk@optexp@abspos\@empty - \ncput[nrot=:U,npos=]{\put@RelLabel{#2}} - \else - \nlput[nrot=:U](tempNode@A)(tempNode@B){\psk@optexp@abspos}{\put@RelLabel{#2}} - \fi - \else - \ncput[nrot=:U,npos=\psk@optexp@position]{\put@RelLabel{#2}} - \fi - % - \endgroup - \fi\fi\fi - % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % - % Show dots for debugging + % + % Now put the label + \put@Label{#1}% + % + % Show some special dots for debugging \ifPst@optexp@debug@showoptdots \psdot[linecolor=red](tempNode@Label) \psdot[linecolor=red](tempNode@LabelShifted) \psdot[linecolor=black](tempNode@A) \psdot[linecolor=black](tempNode@B) \fi -}\ignorespaces}% +\ignorespaces}% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% IMPLEMENTATIONS OF ALL ...@iii MACROS % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % MIRROR % -\def\pst@draw@mirror{{% - \pstVerb{% - /m@width \psk@optexp@mirror@width\space def - } - \ifPst@optexp@variable - \psarc[linewidth=0.8\pslinewidth,arrowinset=0,arrowscale=0.8]{<->} - (! m@width 2 div 0.4 sub 0){0.6}{-20}{20} - \psarc[linewidth=0.8\pslinewidth,arrowinset=0,arrowscale=0.8]{<->} - (! m@width 2 div 0.4 sub neg 0){0.6}{160}{200} +\def\mirror@iii{% + \edef\@mirror@ht{\psk@optexp@mirror@width\space\pst@number\psyunit mul 2 div }% + \edef\@mirror@dp{\psk@optexp@mirror@depth\space\pst@number\psxunit mul }% + \edef\@mirror@r{\psk@optexp@mirror@radius\space\pst@number\psxunit mul }% + \edef\@mirror@postcode{neg 5 -1 roll exch 5 2 roll 90 add exch 90 add exch ArcR }% + \edef\@mirror@extpostcode{neg \@mirror@dp add 5 -1 roll exch 5 2 roll 90 add exch 90 add }% + % + % + % concave mirrors + % + \ifdim\psk@optexp@mirror@radius pt<0pt + % always draw the input plane + \begin@OpenObj + \addto@pscode{\pst@optexpdict \@mirror@ht \@mirror@r rightConcave \@mirror@postcode end}% + \end@OpenObj + \ifx\psk@optexp@mirror@type\pst@string@mirror@type@extended + % + % extended concave mirror + \psset{style=ExtendedMirror} + \begin@ClosedObj + \addto@pscode{\pst@optexpdict \@mirror@ht \@mirror@r rightConcave \@mirror@postcode + \@mirror@ht \@mirror@r rightConcave \@mirror@extpostcode arc + closepath end}% + \end@ClosedObj + \fi + % + % + % convex mirrors + % + \else\ifdim\psk@optexp@mirror@radius pt>0pt + % always draw the input plane + \begin@OpenObj + \addto@pscode{\pst@optexpdict \@mirror@ht \@mirror@r rightConvex \@mirror@postcode end}% + \end@OpenObj + \ifx\psk@optexp@mirror@type\pst@string@mirror@type@extended + % + % extended convex mirror + \psset{style=ExtendedMirror} + \begin@ClosedObj + \addto@pscode{\pst@optexpdict \@mirror@ht \@mirror@r rightConvex \@mirror@postcode + \@mirror@ht \@mirror@r rightConvex \@mirror@extpostcode arcn + closepath end}% + \end@ClosedObj + \fi + \else + % + % plain mirror + % + \edef\@m@wd{\psk@optexp@mirror@width\space 2 div } + \ifPst@optexp@variable + \psarc[linewidth=0.8\pslinewidth,arrowinset=0,arrowscale=0.8]{<->} + (! \@m@wd 0.4 sub 0){0.6}{-20}{20} + \psarc[linewidth=0.8\pslinewidth,arrowinset=0,arrowscale=0.8]{<->} + (! \@m@wd 0.4 sub neg 0){0.6}{160}{200} \fi - \psline[linewidth=\psk@optexp@mirror@linewidth](! m@width -2 div - 0)(! m@width 2 div 0) + \psline[linewidth=\psk@optexp@mirror@linewidth](! \@m@wd neg 0)(! \@m@wd 0) % % mirrortype \ifx\psk@optexp@mirror@type\pst@string@mirror@type@piezo% - % - % piezo - \psframe[style=PiezoMirror](! m@width 8 div 0)(! m@width -8 div m@width 5 div) - \psbezier(! 0 m@width 5 div)% - (! 0 m@width 3 div)% - (! m@width 4 div m@width 4 div)% - (! m@width 8 div m@width 2 div)% + % + % piezo + \psframe[style=PiezoMirror](! \@m@wd 4 div 0)(! \@m@wd -4 div \@m@wd 2.5 div) + \psbezier(! 0 \@m@wd 2.5 div)% + (! 0 \@m@wd 1.5 div)% + (! \@m@wd 2 div \@m@wd 2 div)% + (! \@m@wd 4 div \@m@wd)% \else\ifx\psk@optexp@mirror@type\pst@string@mirror@type@extended% - % - % extended - \psframe[style=ExtendedMirror]% - (! m@width -2 div \psk@optexp@mirror@depth\space )% - (! m@width 2 div 0)% + % + % extended + \psframe[style=ExtendedMirror]% + (! \@m@wd neg \psk@optexp@mirror@depth\space )% + (! \@m@wd 0)% \fi\fi - % - % labelnode - \pnode(0,0){tempNode@Label} -}\ignorespaces}% + \fi\fi +}% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% +% % LENS % -\def\pst@draw@lens{{% +\def\lens@iii{% + % + % use old lens code to maintain backward compatibility + \ifx\psk@optexp@lens@type\@empty + % NEW CODE! + \begin@ClosedObj + \edef\@lens@wd{\psk@optexp@lens@width\space\pst@number\psxunit mul 2 div }% + \edef\@lens@ht{\psk@optexp@lens@height\space\pst@number\psyunit mul 2 div }% + \edef\@lens@rL{\psk@optexp@lens@radiusLeft\space\pst@number\psxunit mul }% + \edef\@lens@rR{\psk@optexp@lens@radiusRight\space\pst@number\psxunit mul }% + \edef\@lens@th{}% + \addto@pscode{\pst@optexpdict}% + % + % distinguish between all the different lens-combination possibilities + % + \ifdim\psk@optexp@lens@radiusLeft pt=0pt\else + \edef\@lens@th{\ifPst@optexp@thicklens \@lens@wd\else a1 \fi}% + \addto@pscode{% + \@lens@ht \@lens@rL + \ifdim\psk@optexp@lens@radiusLeft pt<0pt + leftConcave + \else + leftConvex + \fi + }% + \fi + \ifdim\psk@optexp@lens@radiusRight pt=0pt\else + \edef\@lens@th{\@lens@th\space\ifPst@optexp@thicklens \@lens@wd\else a2 \fi}% + \addto@pscode{% + \@lens@ht \@lens@rR + \ifdim\psk@optexp@lens@radiusRight pt<0pt + rightConcave + \else + rightConvex + \fi + }% + \fi + % + % check some special cases + % + % 1) Left is plain - right concave + % \- right convex + \ifdim\psk@optexp@lens@radiusLeft pt=0pt + \ifdim\psk@optexp@lens@radiusRight pt=0pt\else + \addto@pscode{\@lens@th 2 div sub neg 5 1 roll }% + \ifdim\psk@optexp@lens@radiusRight pt<0pt + \addto@pscode{% + \@lens@th 2 div neg \@lens@ht neg moveto ArcR + \@lens@th 2 div neg \@lens@ht lineto}% + \else + \addto@pscode{ArcR}% + \fi + \fi + \fi + % + % + % 2) Right is plain - left concave + % \- left convex + \ifdim\psk@optexp@lens@radiusRight pt=0pt + \ifdim\psk@optexp@lens@radiusLeft pt=0pt\else + \addto@pscode{\@lens@th 2 div sub 5 1 roll }% + \ifdim\psk@optexp@lens@radiusLeft pt<0pt + \addto@pscode{\@lens@th 2 div \@lens@ht moveto ArcL + \@lens@th 2 div \@lens@ht neg lineto }% + \else + \addto@pscode{ArcL }% + \fi + \fi + \fi + % + % 3) right and left are both curved + \ifdim\psk@optexp@lens@radiusRight pt=0pt\else + \ifdim\psk@optexp@lens@radiusLeft pt=0pt\else + \addto@pscode{% + \@lens@th\space add 2 div dup + 7 1 roll sub neg 5 1 roll + ArcR sub 5 1 roll ArcL }% + \fi + \fi + % + % now complete the object + \addto@pscode{closepath 1 setlinejoin end }% + \end@ClosedObj + % + % OLD CODE (compatibility) + \else + \pst@draw@lens + \fi +\ignorespaces}% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - \pstVerb{% - /lens@h \psk@optexp@lens@height\space 2.0 div def - }% +% LENS (old) maintained for backward compatibility +% used only if lensheight and lenswidth must be used to draw the lens +% (i.e. when lensradius is not defined) +% +\def\pst@draw@lens{% +% + \edef\@l@h{\psk@optexp@lens@height\space 2 div\space}% + \edef\@l@a{\psk@optexp@lens@width\space 2 div\space}% % \ifnum\psk@optexp@lens@type<3 - % % CONVEX - % - % Use only parameters 'lenswidth' and 'lensheight' to draw the lens, if 'lensradius' - % is not set - % - \ifx\psk@optexp@lens@radius\@empty - \pstVerb{% - /lens@a \psk@optexp@lens@width\space 2.0 div def - /lens@r lens@a 2.0 div lens@h lens@h mul 2.0 lens@a mul div add def - }% - % - % otherwise use 'lensradius' and 'lensheight' - % - \else - \pstVerb{% - /lens@r \psk@optexp@lens@radius\space def - /lens@a lens@r lens@r 2 exp lens@h 2 exp sub sqrt sub def - }% - \fi% - % - % define some parameters only for convex lenses - % - \pstVerb{% - /lens@d lens@r lens@a sub def - /lens@alpha lens@h lens@d atan def - /lens@yshift lens@d def - }% - \else - % - % CONCAVE - % - % All three parameters 'lensheight', 'lenswidth' and 'lensradius' are needed - \pstVerb{% - /lens@a \psk@optexp@lens@width\space 2.0 div def - }% - \ifx\psk@optexp@lens@radius\@empty - \pstVerb{% - /lens@r lens@h 1.5 mul def - }% + \ifx\psk@optexp@lens@radius\@empty + \edef\@l@r{\@l@a 2 div \@l@h dup mul 2 \@l@a mul div add\space}% + \else + \edef\@l@r{\psk@optexp@lens@radius\space}% + \edef\@l@a{\@l@r dup dup mul \@l@h dup mul sub sqrt sub\space}% + \fi + % + % define some parameters only for convex lenses + \edef\@l@d{\@l@r \@l@a sub\space}% + \edef\@l@alpha{\@l@h \@l@d atan\space}% + \edef\@l@y{\@l@d\space}% \else - \pstVerb{% - /lens@r \psk@optexp@lens@radius\space def - }% - \fi% - % - % define some parameters only for concave lenses - % - \pstVerb{% - /lens@d lens@r dup mul lens@h dup mul sub sqrt def - /lens@alpha lens@h lens@d atan def - /lens@yshift lens@r lens@a add def - }% + % CONCAVE + \ifx\psk@optexp@lens@radius\@empty + \edef\@l@r{\@l@h 1.5 mul\space}% + \else + \edef\@l@r{\psk@optexp@lens@radius\space}% + \fi% + % + % define some parameters only for concave lenses + \edef\@l@d{\@l@r dup mul \@l@h dup mul sub sqrt\space}% + \edef\@l@alpha{\@l@h \@l@d atan\space}% + \edef\@l@y{\@l@r \@l@a add\space}% \fi% % % \def\temp@LeftPlot{% \parametricplot[liftpen=1]{-1}{1}{% - lens@r lens@alpha t mul 180 add cos mul lens@yshift add lens@r lens@alpha t mul 180 add sin mul}% + \@l@r \@l@alpha t mul 180 add cos mul \@l@y add \@l@r \@l@alpha t mul 180 add sin mul}% }% \def\temp@RightPlot{% \parametricplot[liftpen=1]{-1}{1}{% - lens@r lens@alpha t mul cos mul lens@yshift sub lens@r lens@alpha t mul sin mul}% + \@l@r \@l@alpha t mul cos mul \@l@y sub \@l@r \@l@alpha t mul sin mul}% }% % % @@ -767,22 +918,22 @@ \closepath% \or % biconvex - \temp@LeftPlot% + \temp@LeftPlot% \temp@RightPlot% \closepath \or % plainconcave \temp@LeftPlot% - \psline[liftpen=1](! 0 lens@h neg)% - (! 0 lens@h)% - (! lens@r lens@d sub lens@a add lens@h)% + \psline[liftpen=1](! 0 \@l@h neg)% + (! 0 \@l@h)% + (! \@l@r \@l@d sub \@l@a add \@l@h)% \closepath \or% % concaveplain \temp@RightPlot% - \psline[liftpen=1](! 0 lens@h)% - (! 0 lens@h neg)% - (! lens@r lens@d sub lens@a add neg lens@h neg)% + \psline[liftpen=1](! 0 \@l@h)% + (! 0 \@l@h neg)% + (! \@l@r \@l@d sub \@l@a add neg \@l@h neg)% \closepath \or % biconcave @@ -791,99 +942,106 @@ \closepath \fi }% - % - % labelnode - \pnode(0,0){tempNode@Label} -}\ignorespaces}% +\ignorespaces}% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % PINHOLE % -\def\pst@draw@pinhole{{% +\def\pinhole@iii{% \psline[linewidth=\psk@optexp@pinhole@linewidth]% (! 0 \psk@optexp@pinhole@oheight\space 2 div)% (! 0 \psk@optexp@pinhole@iheight\space 2 div)% \psline[linewidth=\psk@optexp@pinhole@linewidth]% (! 0 \psk@optexp@pinhole@oheight\space -2 div)% (! 0 \psk@optexp@pinhole@iheight\space -2 div)% - % - % labelnode - \pnode(0,0){tempNode@Label} -}\ignorespaces} +\ignorespaces} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % BEAMSPLITTER % -\def\pst@draw@beamsplitter{{% - \pstVerb{% - /bs@width \psk@optexp@bssize\space 2.0 div def - }% - \psline{cc-cc}(! bs@width neg 2 sqrt mul 0)% - (! bs@width 2 sqrt mul 0) - \rput[c]{45}(0,0){\psframe(! bs@width neg bs@width neg)(! bs@width bs@width)} - % - % labelnode - \pnode(0,0){tempNode@Label} -}\ignorespaces}% +\def\beamsplitter@iii{% + \edef\@bs@wd{\psk@optexp@bssize\space 2.0 div\space}% + \psline{cc-cc}(! \@bs@wd neg 2 sqrt mul 0)(! \@bs@wd 2 sqrt mul 0) + \rput[c]{45}(0,0){\psframe(! \@bs@wd neg \@bs@wd neg)(! \@bs@wd \@bs@wd)} +\ignorespaces}% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % CRYSTAL % -\def\pst@draw@crystal{{% - \rput[c]{\psk@optexp@angle}(0,0){% - \pstVerb{% - /c@width \psk@optexp@crystal@width\space 2 div def - /c@height \psk@optexp@crystal@height\space 2 div def - /c@caxisL \psk@optexp@crystal@caxislength\space 2 div def}% - \psframe(! c@width neg c@height neg)(! c@width c@height) - \ifPst@optexp@crystal@voltage% - \psline(! c@width 4 div 3 mul neg c@height)% - (! c@width 4 div 3 mul neg c@height 0.2 add) - \pscircle[fillstyle=solid,% - fillcolor=white](! c@width 4 div 3 mul neg c@height 0.2 add){0.04} - \psline(! c@width 4 div 3 mul neg c@height neg)% - (! c@width 4 div 3 mul neg c@height neg 0.2 sub)% - \psline(! c@width 4 div 3 mul neg 0.15 sub c@height neg 0.2 sub)% - (! c@width 4 div 3 mul neg 0.15 add c@height neg 0.2 sub)% - \fi - % - \ifPst@optexp@crystal@lamp - \rput{180}(! c@width c@height 1.4 \psk@optexp@lamp@scale\space mul add){\lamp}% - \fi - \ifPst@optexp@crystal@caxisinv - % - % invert the c-axis - \psline[linestyle=dashed,% - dash=2pt 2pt,% - linewidth=0.7\pslinewidth,% - arrowinset=0]{->}% - (! 0 c@height neg)(! 0 c@height c@caxisL add)% - \else - \psline[linestyle=dashed,% - dash=2pt 2pt,% - linewidth=0.7\pslinewidth,% - arrowinset=0]{->}% - (! 0 c@height)(! 0 c@height neg c@caxisL sub)% - \fi +\def\crystal@iii{% + \edef\@c@wd{\psk@optexp@crystal@width\space 2 div\space}% + \edef\@c@ht{\psk@optexp@crystal@height\space 2 div\space}% + \rput[c]{\psk@optexp@angle}(0,0){% + \psframe(! \@c@wd neg \@c@ht neg)(! \@c@wd \@c@ht) + \ifPst@optexp@crystal@voltage% + \psline(! \@c@wd 4 div 3 mul neg \@c@ht)% + (! \@c@wd 4 div 3 mul neg \@c@ht 0.2 add) + \pscircle[fillstyle=solid,% + fillcolor=white](! \@c@wd 4 div 3 mul neg \@c@ht 0.2 add){0.04} + \psline(! \@c@wd 4 div 3 mul neg \@c@ht neg)% + (! \@c@wd 4 div 3 mul neg \@c@ht neg 0.2 sub)% + \psline(! \@c@wd 4 div 3 mul neg 0.15 sub \@c@ht neg 0.2 sub)% + (! \@c@wd 4 div 3 mul neg 0.15 add \@c@ht neg 0.2 sub)% + \fi + % + \ifPst@optexp@crystal@lamp + \rput{180}(! \@c@wd \@c@ht 1.4 \psk@optexp@lamp@scale\space mul add){\lamp}% + \fi + % plot c-axis only, if caxislength > 0 + \ifdim\psk@optexp@crystal@caxislength pt>0pt + \edef\@c@caxisL{\psk@optexp@crystal@caxislength\space 2 div\space}% + \ifPst@optexp@crystal@caxisinv + % + % invert the c-axis + \psline[linestyle=dashed,% + dash=2pt 2pt,% + linewidth=0.7\pslinewidth,% + arrowinset=0]{->}% + (! 0 \@c@ht neg)(! 0 \@c@ht \@c@caxisL add)% + \else + \psline[linestyle=dashed,% + dash=2pt 2pt,% + linewidth=0.7\pslinewidth,% + arrowinset=0]{->}% + (! 0 \@c@ht)(! 0 \@c@ht neg \@c@caxisL sub)% + \fi + \fi }% - % - % labelnode - \pnode(0,0){tempNode@Label} -}\ignorespaces}% +\ignorespaces}% +% +% LAMP FOR THE CRYSTAL +% +\def\lamp{% + \psset{linewidth=0.6\pslinewidth} + \edef\@l@s{\psk@optexp@lamp@scale\space}% + % + \pscurve[fillstyle=none](! -0.05 \@l@s mul 0)% + (! -0.1 \@l@s mul 0.15 \@l@s mul)% + (! -0.2 \@l@s mul 0.25 \@l@s mul)% + (! -0.25 \@l@s mul 0.5 \@l@s mul)% + (! 0 0.7 \@l@s mul)% + (! 0.25 \@l@s mul 0.5 \@l@s mul)% + (! 0.2 \@l@s mul 0.25 \@l@s mul)% + (! 0.1 \@l@s mul 0.15 \@l@s mul)% + (! 0.05 \@l@s mul 0) + \multido{\i=-210+40}{7}{% + \rput{\i}(! 0 0.45 \@l@s mul){\psline(! -0.35 \@l@s mul 0)(! -0.6 \@l@s mul 0)} + } +\ignorespaces}% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % POLARIZATION % -\def\pst@draw@polarization{{% +\def\polarization@iii{% % + \edef\@pol@size{\psk@optexp@polarization@size\space 2 div\space}% \ifx\psk@optexp@pol@type\pst@string@pol@polparallel \psline[linestyle=solid,linewidth=\psk@optexp@polarization@linewidth,arrowscale=0.8]{<->}% - (! 0 \psk@optexp@polarization@size\space 2 div neg)% - (! 0 \psk@optexp@polarization@size\space 2 div)% + (! 0 \@pol@size neg)(! 0 \@pol@size)% \fi \ifx\psk@optexp@pol@type\pst@string@pol@polperp \psdot[dotsize=0.05](0,0)% @@ -891,147 +1049,115 @@ \fi \ifx\psk@optexp@pol@type\pst@string@pol@polmisc \psline[linestyle=solid,linewidth=\psk@optexp@polarization@linewidth,arrowscale=0.8]{<->}% - (! 0 \psk@optexp@polarization@size\space 2 div neg)% - (! 0 \psk@optexp@polarization@size\space 2 div)% + (! 0 \@pol@size neg)(! 0 \@pol@size)% \psdot[dotsize=0.05](0,0)% - \pscircle[fillstyle=none,linestyle=solid,linewidth=0.7\pslinewidth](0,0){0.12} + \pscircle[fillstyle=none,linestyle=solid,linewidth=0.7\pslinewidth](0,0){0.12}% \fi \ifx\psk@optexp@pol@type\pst@string@pol@polrcirc - \psellipticarc[linewidth=\psk@optexp@polarization@linewidth]{->}(0,0)(! - \psk@optexp@polarization@size\space 4 div - \psk@optexp@polarization@size\space 2 div)% - {20}{-20} + \psellipticarc[linewidth=\psk@optexp@polarization@linewidth]{->}% + (0,0)(! \@pol@size 2 div \@pol@size){20}{-20}% \fi \ifx\psk@optexp@pol@type\pst@string@pol@pollcirc - \psellipticarc[linewidth=\psk@optexp@polarization@linewidth]{<-}(0,0)(! - \psk@optexp@polarization@size\space 4 div - \psk@optexp@polarization@size\space 2 div)% - {20}{-20} + \psellipticarc[linewidth=\psk@optexp@polarization@linewidth]{<-}% + (0,0)(! \@pol@size 2 div \@pol@size){20}{-20} \fi - \pnode(0,0){tempNode@Label} -}\ignorespaces}% +\ignorespaces}% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % OPTICAL GRID % -\def\pst@draw@optgrid{{% - \pstVerb{% - /g@count \psk@optexp@optgrid@count\space def - /g@width \psk@optexp@optgrid@width\space 2 div def - /g@height \psk@optexp@optgrid@height\space def - /g@depth \psk@optexp@optgrid@depth\space def - /g@step g@width 2 mul g@count div def}% - \ifPst@optexp@reverse% +\def\optgrid@iii{% + \edef\@g@cnt{\psk@optexp@optgrid@count\space}% + \edef\@g@wd{\psk@optexp@optgrid@width\space 2 div\space}% + \edef\@g@ht{\psk@optexp@optgrid@height\space}% + \edef\@g@dp{\psk@optexp@optgrid@depth\space}% + \edef\@g@step{\psk@optexp@optgrid@width\space\@g@cnt div\space}% + \ifx\psk@optexp@optgrid@type\pst@string@optgrid@type@blazed + \ifPst@optexp@reverse% + \pscustom[linewidth=\psk@optexp@optgrid@linewidth]{% + \psline[liftpen=1](! \@g@wd \@g@dp)(! \@g@wd \@g@ht)% + (! \@g@wd neg \@g@ht)(! \@g@wd neg \@g@dp) + \multido{\i=0+1}{\psk@optexp@optgrid@count}{% + \psline[liftpen=1](! \@g@wd neg \i\space \@g@step mul add \@g@dp)% + (! \@g@wd neg \i\space \@g@step mul add 0)% + (! \@g@wd neg \i\space 1 add \@g@step mul add \@g@dp)% + }% + \closepath + }% + \else% + \pscustom[linewidth=\psk@optexp@optgrid@linewidth]{% + \psline[liftpen=1](! \@g@wd \@g@dp)(! \@g@wd \@g@ht)% + (! \@g@wd neg \@g@ht)(! \@g@wd neg \@g@dp) + \multido{\i=0+1}{\psk@optexp@optgrid@count}{% + \psline[liftpen=1](! \@g@wd neg \i\space \@g@step mul add \@g@dp)% + (! \@g@wd neg \i\space 1 add \@g@step mul add 0)% + (! \@g@wd neg \i\space 1 add \@g@step mul add \@g@dp)% + }% + \closepath + }% + \fi% + \else\ifx\psk@optexp@optgrid@type\pst@string@optgrid@type@binary \pscustom[linewidth=\psk@optexp@optgrid@linewidth]{% - \psline[liftpen=1](! g@width g@depth)(! g@width g@height)% - (! g@width neg g@height)(! g@width neg g@depth) + \psline[liftpen=1](! \@g@wd \@g@dp)(! \@g@wd \@g@ht)% + (! \@g@wd neg \@g@ht)(! \@g@wd neg \@g@dp) \multido{\i=0+1}{\psk@optexp@optgrid@count}{% - \psline[liftpen=1](! g@width neg \i\space g@step mul add g@depth)% - (! g@width neg \i\space g@step mul add 0)% - (! g@width neg \i\space 1 add g@step mul add g@depth)% - } - \closepath + \psline[liftpen=1](! \@g@wd neg \i\space \@g@step mul add \@g@dp)% + (! \@g@wd neg \i\space \@g@step mul add 0)% + (! \@g@wd neg \i\space 0.5 add \@g@step mul add 0)% + (! \@g@wd neg \i\space 0.5 add \@g@step mul add \@g@dp)% + (! \@g@wd neg \i\space 1 add \@g@step mul add \@g@dp)% + }% }% - \else% - \pscustom[linewidth=\psk@optexp@optgrid@linewidth]{% - \psline[liftpen=1](! g@width g@depth)(! g@width g@height)% - (! g@width neg g@height)(! g@width neg g@depth) - \multido{\i=0+1}{\psk@optexp@optgrid@count}{% - \psline[liftpen=1](! g@width neg \i\space g@step mul add g@depth)% - (! g@width neg \i\space 1 add g@step mul add 0)% - (! g@width neg \i\space 1 add g@step mul add g@depth)% - } - \closepath - }% - \fi% - % - % labelnode - \pnode(0,0){tempNode@Label} -}\ignorespaces}% + \fi\fi +\ignorespaces}% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % OPTBOX % -\def\pst@draw@optbox{{% - \pstVerb{% - /box@width \psk@optexp@optbox@width\space def - /box@height \psk@optexp@optbox@height\space def - }% +\def\optbox@iii{% + \edef\@b@wd{\psk@optexp@optbox@width\space 2 div\space}% + \edef\@b@ht{\psk@optexp@optbox@height\space 2 div\space}% \ifPst@optexp@endbox - \pnode(! box@width 2 div 0){tempNode@Label}% - \psframe(! 0 box@height 2 div neg)% - (! box@width box@height 2 div)% + \pnode(! \@b@wd 0){tempNode@Label}% + \psframe(! 0 \@b@ht neg)(! \@b@wd 2 mul \@b@ht)% \else - \pnode(0,0){tempNode@Label}% \rput{\psk@optexp@angle}(0,0){% - \psframe(! box@width 2 div neg box@height 2 div neg)% - (! box@width 2 div box@height 2 div)% + \psframe(! \@b@wd neg \@b@ht neg)(! \@b@wd \@b@ht)% }% \fi -}\ignorespaces}% +\ignorespaces}% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % OPTPLATE % -\def\pst@draw@optplate{{% +\def\optplate@iii{% \psline[linewidth=\psk@optexp@plate@linewidth]% (! 0 \psk@optexp@plate@height\space 2 div neg)% (! 0 \psk@optexp@plate@height\space 2 div) - % - % labelnode - \pnode(0,0){tempNode@Label} -}\ignorespaces}% +\ignorespaces}% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DETECTOR % -\def\pst@draw@detector{{% +\def\detector@iii{% \pnode(! \psk@optexp@detector@size\space 3 div 0){tempNode@Label}% \pswedge(0,0){\psk@optexp@detector@size}{-90}{90} -}\ignorespaces}% +\ignorespaces}% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % OPTRETPLATE % -\def\pst@draw@optretplate{{% - \pstVerb{% - /orp@height \psk@optexp@plate@height\space 2.0 div def - /orp@width \psk@optexp@plate@width\space 2.0 div def - }% - \psframe(! orp@width neg orp@height neg)(! orp@width orp@height) - \psline{cc-cc}(! orp@width neg orp@height)% - (! orp@width orp@height neg) - % - % labelnode - \pnode(0,0){tempNode@Label} -}\ignorespaces}% -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% LAMP FOR THE CRYSTAL -% -\def\lamp{{% - \psset{linewidth=0.6\pslinewidth} - \pstVerb{/l@s \psk@optexp@lamp@scale\space def} - % - \pscurve[fillstyle=none](! -0.05 l@s mul 0)% - (! -0.1 l@s mul 0.15 l@s mul)% - (! -0.2 l@s mul 0.25 l@s mul)% - (! -0.25 l@s mul 0.5 l@s mul)% - (! 0 0.7 l@s mul)% - (! 0.25 l@s mul 0.5 l@s mul)% - (! 0.2 l@s mul 0.25 l@s mul)% - (! 0.1 l@s mul 0.15 l@s mul)% - (! 0.05 l@s mul 0) - \multido{\i=-210+40}{7}{% - \rput{\i}(! 0 0.45 l@s mul){\psline(! -0.35 l@s mul 0)(! -0.6 l@s mul 0)} - } -}\ignorespaces}% +\def\optretplate@iii{% + \edef\@p@ht{\psk@optexp@plate@height\space 2 div\space}% + \edef\@p@wd{\psk@optexp@plate@width\space 2 div\space}% + \psframe(! \@p@wd neg \@p@ht neg)(! \@p@wd \@p@ht) + \psline{cc-cc}(! \@p@wd neg \@p@ht)(! \@p@wd \@p@ht neg) +\ignorespaces}% % % \endinput |